ejb - Message Driven Bean listen to JMS remote destinations (Weblogic) -
ejb - Message Driven Bean listen to JMS remote destinations (Weblogic) -
greeting, i'm new java ee , message driven bean followed tutorial has been working internal jms destinations (e.g. weblogic server runs on local machine). i'm trying hear new messages remote destinations (e.g. weblogic server run on different machine). i'm thinking jndi naming lookup don't see appropriate place implement in mdb. question need config files in order work? or possible hear remote jms destinations?
@messagedriven(mappedname="jms/myqueue") //jms/myqueue remote queue name public class pmqueuelistener implements messagelistener{ @resource private messagedrivencontext mdc; /** * default constructor. */ public pmqueuelistener() { system.out.println("this onmessage()"); } /** * @see messagelistener#onmessage(message) */ public void onmessage(message message) { textmessage msg = null; seek { if (message instanceof textmessage) { msg = (textmessage) message; system.out.println("message bean: message received: " + msg.gettext()); } else { system.out.println("message of wrong type: " + message.getclass().getname()); } } grab (jmsexception e) { e.printstacktrace(); mdc.setrollbackonly(); } grab (throwable te) { te.printstacktrace(); } } }
you can add together below annotation on mdb , see if works you.
@transactionmanagement(transactionmanagementtype.container) @transactionattribute(transactionattributetype.required)
ejb
Comments
Post a Comment