|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
File transfer..Please hep me:( |
« View previous topic :: View next topic » |
Author |
Message
|
vk |
Posted: Thu Jul 06, 2006 1:37 pm Post subject: |
|
|
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 |
|
 |
vk |
Posted: Thu Jul 06, 2006 1:40 pm Post subject: |
|
|
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 |
|
 |
kotha |
Posted: Tue Jul 11, 2006 11:45 am Post subject: |
|
|
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 |
|
 |
kotha |
Posted: Tue Jul 11, 2006 11:47 am Post subject: |
|
|
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 |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|