ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Interchange Server + Adapters » File transfer..Please hep me:(

Post new topic  Reply to topic
 File transfer..Please hep me:( « View previous topic :: View next topic » 
Author Message
vk
PostPosted: Thu Jul 06, 2006 1:37 pm    Post subject: Reply with quote

Partisan

Joined: 20 Sep 2005
Posts: 302
Location: Houston

Try using the JText Adapter. It can read from any file created in the Event Directory and send the file contents to an MQ queue.

Regards,
VK.
Back to top
View user's profile Send private message
vk
PostPosted: Thu Jul 06, 2006 1:40 pm    Post subject: Reply with quote

Partisan

Joined: 20 Sep 2005
Posts: 302
Location: Houston

Quote:
is there any way to E-mail the User thru MQ


EMail Adapter can send Email from a message in the MQ queue. Or if you are using Message Broker, you can have a flow with SendMailPlugIn node to send Emails.

Regards,
VK.
Back to top
View user's profile Send private message
kotha
PostPosted: Tue Jul 11, 2006 11:45 am    Post subject: Reply with quote

Partisan

Joined: 12 Mar 2005
Posts: 333

If you dont have adapters, you can write a simple java program to send e-mail. About picking the files automatically, I guess there should be a way to do it using a java program. this way of doing is cumbersome but it is one way to implement with out using adapters.

the follwing program written by me when i was using workflow. but this program gives you insight how to get a message from a queue and send email. for more information, PM me.

Code:
import java.lang.*;
import java.util.Properties;
import javax.mail.*;
import javax.mail.internet.*;


public class SendMail {
    public void sendMail(String message,String groupMailId) {
        boolean debug = false;
        try {
            String recipients=groupMailId;
            String subject="hi from Sridhar";
            String from="SKanaparthi-Consultant@scholastic.com";


            //Set the host smtp address
            Properties props = new Properties();
            props.put("mail.smtp.host", "bizmail.abc.com");

            // create some properties and get the default Session
            Session session = Session.getDefaultInstance(props, null);
            session.setDebug(debug);

            // create a message
            Message msg = new MimeMessage(session);
            //msg.setFrom(new InternetAddress(from));
            InternetAddress[] address = {new InternetAddress(recipients)};
            msg.setRecipients(Message.RecipientType.TO, address);
            msg.setSubject(subject);

            // set the from and to address
            InternetAddress addressFrom = new InternetAddress(from);
            msg.setFrom(addressFrom);

            // Setting the Subject and Content Type
            msg.setContent(message, "text/plain");

            Transport.send(msg);

            System.out.println(" Message sent to " + recipients.toString());

        }catch(Exception e){e.printStackTrace();}
    }

    /* public static void main(String[] args){
        SendMail sendMail = new SendMail();
        String message="asdhiasda";
        sendMail.sendMail(message,"Skotha@abc.com");
    } */
}


Hope this helps.
Back to top
View user's profile Send private message
kotha
PostPosted: Tue Jul 11, 2006 11:47 am    Post subject: Reply with quote

Partisan

Joined: 12 Mar 2005
Posts: 333

Another program to get message from a Q:

import com.ibm.mq.MQC;
import com.ibm.mq.MQException;
import com.ibm.mq.MQGetMessageOptions;
import com.ibm.mq.MQMessage;
import com.ibm.mq.MQQueue;
import com.ibm.mq.MQQueueManager;

public class MQGet extends Object {


public MQGet() {
}

/**
* @param args the command line arguments
*/
public static void main (String args[]) {

try {

String QM = "FMCQM";
String QUEUE = "MYUPES";

System.out.println("Starting SendAndReceive Program: ");
MQQueueManager qmgr = new MQQueueManager(QM);
System.out.println("Connected to QMGR " + QM);

int openOptionsForGet = MQC.MQOO_INPUT_SHARED ;
MQQueue OutQueue = qmgr.accessQueue(QUEUE , openOptionsForGet, null, null, null);
MQGetMessageOptions gmo = new MQGetMessageOptions() ;

MQMessage outMessage = new MQMessage();


gmo.matchOptions = MQC.MQMO_MATCH_MSG_ID;
OutQueue.get(outMessage, gmo);


String msgTxt = outMessage.readString(outMessage.getMessageLength());
System.out.println (" The message is \n" + msgTxt);

//if(msgTxt.indexOf("author")== -1){
//parses the customer details , staff details and mail id
MessageParser msgParser=new MessageParser(msgTxt); //msgTxt is XML
//System.out.println("MESSAGE DETAILS : "+msgParser.getAllDetails());
System.out.println("Email ID of the author : "+msgParser.getEmailauthor());
System.out.println("Message from workflow : "+msgParser.getSendmessage());
//sends a mail to the groupMail
SendMail sMail= new SendMail();
System.out.println();
sMail.sendMail(msgParser.getSendmessage(), msgParser.getEmailauthor());;

OutQueue.close();
qmgr.disconnect() ;

}
catch(MQException ex){
System.out.println("MQ Error - Reason code :" + ex.reasonCode);
}
catch (Exception e){
System.out.println("Error : " + e);
}

}

}
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Interchange Server + Adapters » File transfer..Please hep me:(
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.