JMS Request/Response example

Hi
I am trying to implement a JMS Request/Response example on glassfish, but i am not getting the correct behaviour.
My code is below. I am sending a message to a queue and adding the setJMSReplyTo another queue. I call the recv.receive(10000); and wait for the messages to be received. But this call blocks the current thread and the MDB that i orginally sent the message to only gets executed after the recv.receive(10000); has timed out after 10 seconds.
Can someone confirm that my code is correct or am i doing something wrong?
Connection connection = null;
Session session = null;
String text = "hello";
try {
System.out.println("Sending " + text);
connection = searchDestFactory.createConnection();
session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
MessageProducer messageProducer = session.createProducer(searchDest);
TextMessage tm = session.createTextMessage();
tm.setText(text);
tm.setJMSReplyTo(destQueue);
messageProducer.send(tm);
System.out.println("Sent " + text);
MessageConsumer recv = session.createConsumer(destQueue);
connection.start();
Message m = recv.receive(10000);
tm = (TextMessage) m;
if(tm != null) System.out.println(tm.getText());
else System.out.println("No message replied");
} catch (JMSException ex) {
System.out.println(ex);
Thanks Glen
Edited by: glen_ on Jun 16, 2008 6:13 AM
Edited by: glen_ on Jun 16, 2008 6:13 AM
Edited by: glen_ on Jun 16, 2008 6:14 AM

Glen,
I have never attempted to use the messaging service the way you have, namely a single instance as both sender and receiver, but I noticed that you do send the message before you register your Consumer. My first and easiest suggestion would be to simply move your consumer block (I would move both lines) above the producer block and try again.
If that attempt fails, I would implement a MessageListener, once again before the producer block and allow it to handle received messages (no need for recv.receive(10000);)
Example:
    public class QueueMessageListener implements MessageListener {
        public void onMessage(Message message) {
            try {
                System.out.println(String.format("From Glassfish: %s received a %s of type %s.", m_Queue.getQueueName(), message.getClass().getName(), message.getJMSType()));
                System.out.println(printJMSMessage(message));
            } catch (JMSException ex) {
            //handle message here
    }and somewhere before the producer block:
            m_msgListener = new QueueMessageListener();
            m_msgConsumer =  m_Session.createConsumer(m_Queue);
            m_msgConsumer.setMessageListener(m_msgListener);
            m_Connection.start();I feel like I've done my good dead for the day :)
-Jerome BG

Similar Messages

  • JMS Request - Response Correlation Not Working

    Hello Experts -
    I am new to OAG and hence seek your expert advice. Following is our use-case scenario:
    1. OAG needs to push a sample XML Message to Weblogic Request JMS Queue. In the Request tab of "Routing to Messaging System filter" I set the CorrelationId
    2. In the response tab wait for a timeout (I set to 600000 secs)
    3. Retrieve Response from the Weblogic Response Queue
    4. Send the Response back to the client
    When i invoke the OAG policy, I am able to post the message to the Request Queue. For my testing purpose, I manually get the correlation id from the request message in the request queue and then populate the same in the response message correlation id field and post the same to the response queue.
    Unfortunately I am not able to see the response back. Below is the log.
    Any help is greatly appreciated.
    Thanks!
    Dibya
    DEBUG   29/Jan/2015:23:38:55.677 [3220]     handle type text/plain with factory class com.vordel.mime.Body$1
    DEBUG   29/Jan/2015:23:38:55.677 [3220]     Added converted message is added to the whiteboard
    DEBUG   29/Jan/2015:23:38:55.677 [3220] } = 1, filter [Request Message on Queue(Set Message)]
    DEBUG   29/Jan/2015:23:38:55.678 [3220] Filter [Request Message on Queue(Set Message)] completes in 1 milliseconds.
    DATA    29/Jan/2015:23:38:55.678 [3220] LogManager logging {
    DATA    29/Jan/2015:23:38:55.678 [3220]     Logging at Success
    DATA    29/Jan/2015:23:38:55.678 [3220]     Calling write log on class com.vordel.log.trace.TraceLogger
    DATA    29/Jan/2015:23:38:55.679 [3220] }
    DEBUG   29/Jan/2015:23:38:55.679 [3220] run filter [Place Message on Weblogic Queue (Messaging system)] {
    DEBUG   29/Jan/2015:23:38:55.893 [2300] start thread 10706770 in set "netsvc threadpool": count=11, busy=10, idle target=4, max=512
    DEBUG   29/Jan/2015:23:38:56.388 [3220]     Set Reply to on a named queue: TokenJMSModule!SMAIPO.ActiveSubscriptionResponse
    DEBUG   29/Jan/2015:23:38:56.389 [3220]     creating consumer from QueueSession
    DEBUG   29/Jan/2015:23:38:56.758 [3220]     cache com.vordel.circuit.jms.JMSProcessor$PoolContextCache@19c45da grows to 3
    DEBUG   29/Jan/2015:23:38:56.759 [3220]     JMSProcessor message ID is: Id-ef18cb542c01000000000000bcac40f9
    DEBUG   29/Jan/2015:23:38:56.760 [3220]     Creating JMS byte message using automime
    DEBUG   29/Jan/2015:23:38:56.760 [3220]     new buffered content factory 10674640
    DEBUG   29/Jan/2015:23:38:56.760 [3220]     buffered content 10674640, size=0/8
    DEBUG   29/Jan/2015:23:38:56.761 [3220]     [10674640] new chunk 10541538 from 10606CC8 to 10606DFE (310)
    DATA    29/Jan/2015:23:38:56.761 [3220]     new content stack 105488F8
    DATA    29/Jan/2015:23:38:56.761 [3220]     push source buffered onto 105488F8
    DEBUG   29/Jan/2015:23:38:56.761 [3220]     Setting reply to named queue
    DEBUG   29/Jan/2015:23:38:56.761 [3220]     setJMSMessageID: Id-ef18cb542c01000000000000bcac40f9
    DEBUG   29/Jan/2015:23:38:56.761 [3220]     setJMSCorrelationID: Id-ef18cb542c01000000000000bcac40f9
    DEBUG   29/Jan/2015:23:38:56.762 [3220]     Calling post JMS creation hook
    DEBUG   29/Jan/2015:23:38:56.762 [3220]     Post JMS creation hook completed
    DEBUG   29/Jan/2015:23:38:56.762 [3220]     Sending JMS message to TokenJMSModule!SMAIPO.ActiveSubscriptionRequest
    DATA    29/Jan/2015:23:38:57.120 [3220]     trace transaction
    DEBUG   29/Jan/2015:23:38:57.121 [3220]     Wait for repsonse ? true
    DEBUG   29/Jan/2015:23:38:57.819 [2300] incoming call on interface localhost:8085 from ::1:63317
    DEBUG   29/Jan/2015:23:38:57.820 [2300] new connection 02F0FB08,  settings source incoming interface (allow 1.1=no, idleTimeout=60000, activeTimeout=60000, contentLength: req=no, res=no)
    DEBUG   29/Jan/2015:23:38:57.820 [2300] push SSL protocol on to connection
    DATA    29/Jan/2015:23:38:57.820 [2300] [SSL_accept, 00006000] before/accept initialization.
    DEBUG   29/Jan/2015:23:38:57.821 [2300] No SSL host name provided, defaulting to certificate: { subject: /CN=instance-1 }.
    DATA    29/Jan/2015:23:38:57.821 [2300] [SSL_accept, 00002110] SSLv3 read client hello A.
    DATA    29/Jan/2015:23:38:57.821 [2300] [SSL_accept, 00002130] SSLv3 write server hello A.
    DATA    29/Jan/2015:23:38:57.823 [2300] [SSL_accept, 000021D0] SSLv3 write change cipher spec A.
    DATA    29/Jan/2015:23:38:57.823 [2300] [SSL_accept, 000021E0] SSLv3 write finished A.
    DATA    29/Jan/2015:23:38:57.823 [2300] [SSL_accept, 00002100] SSLv3 flush data.
    DATA    29/Jan/2015:23:38:57.824 [2300] [SSL_accept, 000021C0] SSLv3 read finished A.
    DEBUG   29/Jan/2015:23:38:57.825 [2300] negotiated SSL cipher "DHE-RSA-AES256-SHA", session 00000000 (reused) peer cert /CN=nodemanager-1
    DATA    29/Jan/2015:23:38:57.825 [2300] client certificate: { subject: /CN=nodemanager-1 }
    DEBUG   29/Jan/2015:23:38:57.826 [30a4] incoming call on interface localhost:8085 from 127.0.0.1:63320
    DATA    29/Jan/2015:23:38:57.826 [2300] rcv 979 from max of 2048: <GET /api/monitoring/metrics/summary?timeline=10m&metricGroupType=Service HTTP/1.1
    Host: localhost:8085
    Accept: application/json
    Accept-Language: en-US,en;q=0.8
    authentication.subject.id: admin
    authentication.subject.role: API Server Operator:API Service Developer:Policy Developer:API Service Administrator:API Server Administrator:Deployer:KPS Administrator
    Authorization: Basic YWRtaW46Y2hhbmdlbWU=
    Cookie: avlastvisit=1411930906; avlastactivity=0; __utma=125953885.1884274842.1414410173.1414410173.1417627152.2; __utmz=125953885.1417627152.2.2.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=(not%20provided); utag_main=_st:1417668298258$ses_id:1417666771075%3Bexp-session; WT_FPC=id=cfc9b752-08a3-4756-8d26-c4ca2d77219f:lv=1417670100029:ss=1417670100029
    Host: localhost:8085
    Referer: https://xx1211000592.global.avaya.com:8090/
    User-Agent: Gateway
    X-Requested-With: XMLHttpRequest
    Connection: close
    X-CorrelationID: Id-f118cb54e204000000000000373fba90 1

    Hi Michael,
    I think the adapter type is for the receiver channel looking at the documentation SAP Library - SAP Exchange Infrastructure
    Have you checked your receiver channel doesn't belong to a party?
    I havent tried this bridge with the http_aae but looks to be problematic according with Michal comment here http://scn.sap.com/community/pi-and-soa-middleware/blog/2014/01/28/generic-pi-async-sync-bridge-configuration-for-any-adapters#comment-454463
    Regards.

  • Blocking Request/Response JMS model

    Hi everyone !
    I'm starting to write a JMS application and I'm having some doubt about the request/response model enabled by the replyTo() method and CorrelationID field. As far is I know JMS is intended to let the client be free from the server's response by posting it's message on the queue and start doing some other work. But supposing the client needs a response from the server(a MDB) after the processing of the message I wonder how would him receive this response, assuming there is a second queue for posting the response messages. Simply using the MessageConsumer.receive() the client will be blocked, killing all the purpose of the model(even with timeout). So I wonder, should I create a second MDB just to handle the response queue ? This would left me with an RPC message producer, a MDB Message consumer (of the request message), and a MDB Message consumer (on the response queue). Is this a normal approach or is there something better ?
    Thank you !

    Simply using the MessageConsumer.receive() the client will be blocked, killing all the purpose of the model(even with timeout).
    You have to send the message and wait for the response in two separate transactions. For example:
    // Start create and send transaction  
    ctx.getUserTransaction().begin();
    connection = connectionFactory.createQueueConnection();
    connection.start();
    session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
    final Message request = // create message
    final Queue tempQueue = session.createTemporaryQueue();
    request.setJMSReplyTo(tempQueue);
    final QueueSender sender = session.createSender(destination);
    sender.send(request);
    ctx.getUserTransaction().commit();
    // End create and send transaction
    // Start receive transaction
    ctx.getUserTransaction().begin();
    final QueueReceiver receiver = session.createReceiver(tempQueue);
    final Message response = receiver.receive(TIMEOUT);
    ctx.getUserTransaction().commit();
    // End receive transaction
    // process response

  • How to implement request/response domain in JMS

    hi friends,
    I need help regarding implementing request/response domain
    in jms.please help me.

    See the TopicRequestor and QueueRequestor helper classes in the JMS API.
    FWIW there's a POJO based request/response implementation using JMS here...
    http://lingo.codehaus.org
    you might find the source code useful as it does efficient request/response in a highly concurrent way using JMS under the covers.
    James
    http://logicblaze.com/

  • JMS Transport, Transactional, asynchronous request-response

    Hi again :)
    I have weblogic web service with jms transport and have chosen session bean implementation.
    I'm testing transactional processing now.
    Required feature is to put getting request from queue and processing it in web service in one transaction.
    During tests I have noticed that:
    When I throw RuntimeException from my web service method the message doesn't come back to the queue.
    When I try to sessionContext.setRollbackOnly(); I get an error
    javax.ejb.EJBException: EJB Exception: : java.lang.IllegalStateException: [EJB:010158]Illegal attempt to call EJBContext.setRollbackOnly() from an EJB that was not participating in a transaction.
    When I deploy web service I get the following warning:
    <Warning> <EJB> <> <AdminServer> <[STANDBY] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1238752023176> <BEA-010212> <The EJB 'EventNotifierServiceEJB(Application: portal, EJBComponent: EventNotifierService-1.0-SNAPSHOT.jar)' contains at least one method without an explicit transaction attribute setting. The default transaction attribute of Supports will be used for the following methods: local[publish(package.PackageType)] >
    And putting @TransactionAttribute(TransactionAttributeType.MANDATORY) doesn't change this.
    So It seems that transactions doesn't work by default.
    I turned on XA in my own jms connection factory used by web service but this didn't help.
    Looking in weblogic documentation I have found the following sentences:
    In (http://e-docs.bea.com/wls/docs103/webserv_adv_rpc/jmstransport.html)
    "If you have specified that the Web Service you invoke using JMS transport also runs within the context of a transaction (in other words, the JWS file includes the @weblogic.jws.Transactional annotation), you must use asynchronous request-response when invoking the service. If you do not, a deadlock will occur and the invocation will fail."
    In (http://e-docs.bea.com/wls/docs103/webserv_adv_rpc/asynch.html)
    "The asynchronous request-response feature works only with HTTP; you cannot use it with the HTTPS or JMS transport."
    For me these two sentences are in conflict.
    Currently I'm trying to use just transactional annotation without asynchronous request-response but the risk of deadlocks doesn't sound good for me.
    BTW I have Oneway annotation in my web service method, I'm not sure if this changes something.
    I'll be grateful for any help in resolving this problem.
    Edited by: user10930859 on Apr 3, 2009 3:49 AM

    Hi Karthik-
    You can link the corelation-id..
    Make you third-party application to receive Message-id from JMSRequestQueue and send this message id as correlation-id to JMSResponseQueue. I guess it would work we have tried this as POC.
    Regards,
    Ramesh

  • Asynchronous Request-Response in JMS using OSB 11g

    Hi All,
    I am using OSB11g.
    I have a scenario where I want to post a request into a JMS requestQueue, and without waiting for the response, should continue posting messages into the queue.
    The response will be posted by a third party into a JMS responseQueue.
    How to go ahead with this scenario? Is there any way to link the request & response in asynchronous calls like this?
    Thanks in advance!!
    Regards,
    Karthik

    Hi Karthik-
    You can link the corelation-id..
    Make you third-party application to receive Message-id from JMSRequestQueue and send this message id as correlation-id to JMSResponseQueue. I guess it would work we have tried this as POC.
    Regards,
    Ramesh

  • Implementing synchronous request response behaviour with JMS

    i have a requirement wherein i send a list of tasks to be executed (this has to be executed in parallel so taking the JMS route) and should wait for the results of al these tasks. How could i do this with JMS? I need JMS since the originally these tasks was being done using threading and since in j2ee it is not advisable to spawn threads we are planning to use JMS so that we can have concurrency that is done by the container. can someone please tell how can i simulate this synchronous request-response paradigm using JMS?

    It may not be great idea however possibility of State full session bean can be explored.
    State full session bean will send all 100 tasks to JMS queue without waiting for the result. There will be another JMS program (Say ResponseCollector) which will listen on queue for all responses. Once ResponseCollector collects all the responses, it will trigger the state full session bean again.
    You can use some properties in JMS header to discriminate between the request and response on same queue and apply the message selector.

  • Blocking Request/Response model

    Hi everyone !
    I'm starting to write a JMS application and I'm having some doubt about the request/response model enabled by the replyTo() method and CorrelationID field. As far is I know JMS is intended to let the client be free from the server's response by posting it's message on the queue and start doing some other work. But supposing the client needs a response from the server(a MDB) after the processing of the message I wonder how would him receive this response, assuming there is a second queue for posting the response messages. Simply using the MessageConsumer.receive() the client will be blocked, killing all the purpose of the model(even with timeout). So I wonder, should I create a second MDB just to handle the response queue ? This would left me with an RPC message producer, a MDB Message consumer (of the request message), and a MDB Message consumer (on the response queue). Is this a normal approach or is there something better ???

    Simply using the MessageConsumer.receive() the client will be blocked, killing all the purpose of the model(even with timeout).
    You have to send the message and wait for the response in two separate transactions. For example:
    // Start create and send transaction  
    ctx.getUserTransaction().begin();
    connection = connectionFactory.createQueueConnection();
    connection.start();
    session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
    final Message request = // create message
    final Queue tempQueue = session.createTemporaryQueue();
    request.setJMSReplyTo(tempQueue);
    final QueueSender sender = session.createSender(destination);
    sender.send(request);
    ctx.getUserTransaction().commit();
    // End create and send transaction
    // Start receive transaction
    ctx.getUserTransaction().begin();
    final QueueReceiver receiver = session.createReceiver(tempQueue);
    final Message response = receiver.receive(TIMEOUT);
    ctx.getUserTransaction().commit();
    // End receive transaction
    // process response

  • HTTP request/response object not thread safe.

    According to the serlvet spec. Http Request/Response
    are not thread safe. Quoting from the Spec:
    " Implementations of the request and response objects are not guaranteed to be thread safe. This means that they should only be used within the scope of the request handling thread. References to the request and response objects must not be given to objects executing in other threads as the resulting behavior may be nondeterministic."
    This has prompt me to ask the following question.
    For Example I have a servlet which does the following
    request.setAttribute("myVar","Hello");
    The request and response is dispatched(using RequestDispatch.include(request,response)) to another
    servlet which retrieve this attribute i.e request.getAttribute("myVar");
    Is this safe?
    The Spec only said "The Container Provider must ensure that the dispatch of the request to a target
    servlet occurs in the same thread of the same VM as the original request." I take this meaning that the targeting servlet does not have to run in the same thread(only dispatch), otherwise it would be safe.

    To put it another way, you can only have onle thing working on a request at a time. For instance, the ServletContext is available to all servlets running on a server. If you tried to save a particular request to the ServletContext, it would potentially be available to many concurrently running servlets. They could all change whatever in it at the same time. Each servlet is in its own running thread. Hope that helps some.

  • Best way to implement request-response and still reliability

              HI,
              what is the best way to implement a request -response paradigm and still have
              the reliability that message will be 100% processed and give response...do i need
              to create the permanant queues with storage..
              anybody gives suggestions..
              Akhil
              

    Hi Akhil,
              Temporary destinations can only store non-persistent messages
              as per JMS spec - so they are not useful for reliable for holding
              responses that must survive longer than the life of the
              interested client. For persistence, you will need to use configured
              queues or durable subscriptions. For detailed
              discussion of request/response, I suggest reading the "WebLogic JMS
              Performance Guide" white-paper on dev2dev.bea.com. If you
              have many clients, or expect large message back-logs,
              there can be a performance impact when using selectors...
              FYI: There is a new pub/sub subscriber index enhancement
              that is available in 8.1 and
              in the latest service-packs for 6.1, 7.0.
              "Indexing Topic Subscriber Message Selectors To Optimize Performance"
              http://edocs.bea.com/wls/docs81/jms/implement.html#1294809
              This may be useful.
              Tom, BEA
              Akhil Nagpal wrote:
              > HI,
              > what is the best way to implement a request -response paradigm and still have
              > the reliability that message will be 100% processed and give response...do i need
              > to create the permanant queues with storage..
              >
              > anybody gives suggestions..
              > Akhil
              

  • Asynchronous request-response feature

    The asynchronous request-response feature works only with HTTP,we can't use it with the HTTPS or JMS transport.
    why??

    this is basic profile and SOAP restriction accroding to W3C.
    I doubt that HTTPs is not possible check W3C web site

  • Client Request/Response Context

    I'm new to Weblogic Integration and have a question regarding client response action.
    I've seen an example of a quick workflow where the webpage calls the process
    and gets a response back. In essence the workflow is synchronous.
    Now I want to include a long running process, using Worklists and involving many
    different actors. During the worklist task acceptance I want to get some feedback
    from the user. My questions is what context does the Client Request/Response
    execute in. The example in the docs shows the worklist application. Is this
    absolutely required? How about a client response to a portlet.
    Thanks,
    noah

    One of the Certification mandates logging the remote client IP AND PORT for each log-event.
    I cannot pass these from GUI client because the user may
    be on a private network. This calls for capturing the IP and PORT at GUI server end.
    Capturing remote IP is simple as SOAP library exposes the request object from which the IP can be obtained.
    The dificult part is to capture port. I addressed this problem by introducing a
    new Tomcat Service Engine, CSMServiceEngine. This engine has access to the underneath socket using which
    i obtain the client port and pass it across to SOAP layer as a x-csm-client-port HTTP theader.
    I have a custom SOAP provider, CSMSoapSPI, which obtains the port using the above x-header and the
    client IP from its request object. THese are done only for 'login' task and hence i published a new
    SOAP service: LoginCommand.
    But bcoz of upgradation of tomcat from 4.0 to 5.0.28 the invoke method in the StandardEngine(which was initially extended by class i posted) is made final with JDK 1.5 and i can no longer use the StandardEngine. Hence i tried with the Valve class.But with no luck.
    Hope this answers ur question

  • Request-response topic questions

    Hi all,
    I'd like to know if the following is possible:
    � Could I configure a request-response topic having several subscribers?
    � If the answer to the last question is affirmative, could I configure a selector (a filter) on those subscribers to get a response only from one of them? (i know i could use directly a queue to receive a synchronous response from a determined destination, but my doubt is related with topics)
    � if the answer is affirmative again. What happens if several subscribers respond to a message?
    Thanks in advance

    Comments bellow:
    1. Yes
    2. Subscribers define their filters. I do not know if you could defined this on the system as administrator
    I don't understand the last phrase, could you give more details? I'll try to explain question 2 again to make sure i am understood (english is not my native language).
    - Suppose I have several subscribers for a determined topic, each with its own filter.
    - Suppose I send a message on that topic.
    - Suppose only one of the subscribers receives the message (its selector doesn't filter the message)
    - This subscriber responds, and I receive a response from it.
    - The rest of the subscribers doesn't receive any response at all.
    Could you confirm this steps?
    3. Each subscriber receives all the responses including his own response as long as he listen to this topic
    According to this point, my affirmation "The rest of the subscribers doesn't receive any response at all." is false +, isn't it?. Why each subscriber receives all the responses? That would only happen if the response is+
    published on the topic, am I right? I'm newbie at JMS Technology, please be patience".
    Thanks for your time.

  • Possible to get runtime info (Http request, response) from a WD4A Appl.?

    Hey,
    In a BSP / JSP application, it is possible to retrieve and set the runtime data (http request and response). For Example:
    response.setContentType("application/x-suvaagent;charset=iso-8859-1");
    response.setHeader("Cache-Control", "public");
    response.getWriter().print("<Request>");
    response.getWriter().print("</Request>");
    Is it possible to do this in a WebDynpro (ABAP) Application?
    The requirement is to construct a file using http response method. This file contains parameters like business data etc. The file type is already registered as a MIME type which is associated with a standalone program.
    When sending the http response, the file will be filled out with needed data and the associated program will be called using the data in the file.
    I haven't found out how to do this in web dynpro application, since we use WD4A in our project.
    Thanks and Regards,
    Liang

    In Web Dynpro you do not have direct access to the Request or Response object. This is part of the design of the abstracted rendering and makes things like the SmartClient and the AJAX based Delta Rendering possible.
    In Web Dynpro you should use the FileDownload UI element or the CL_WD_RUNTIME_SERVICES=>ATTACH_FILE_TO_RESPONSE
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/47/a8d95673b12fe2e10000000a42189d/frameset.htm
    If you want more control over the response object for a download then I might suggest that you can create a cached response object, place it into the ICM cache and generate a unique URL for it.  You can then fire a navigation plug or a LinkToURL to go to that cached response object.

  • Can MDB make synchronous JMS request

    I'm trying to find what design patterns are appropriate for certain tasks. I am new to Java EE.
    I wanted an MDB to make a JMS request to another MDB, and then listen (for a fixed amount of time) for a response, then finish up and return.
    A) Is this possible
    B) is this appropriate? Is there a better pattern assuming that the initial work arrives via JMS. Assume the second bean is on a different container instance (performance is a big issue)
    In my experiments, the first MDB gets a message, queues it to the second, does a receive with timeout, and gets a null back. Meanwhile the second MDB puts a message on the response queue (I can see it with JMS tools after things calm down).
    The NEXT time I send a message to the queue served by the MDB, it sends another message towards the second bean, then RECEIVES THE MESSAGE LEFT OVER FROM THE FIRST ATTEMPT.
    I suspect I am running afoul of transaction behavior or some such.
    Thoughts?

    Thanks
    The transactional nature is basically a nuisance. I am doing synchronous processing and if the message vanishes, so be it.
    I think my problem is that I need a BMT type MDB, but I don't know how to annotate it. Then I can commit the transaction that caused the bean to activate, and then proceed about my business. Testing implies that the message sent to the second (reflector) bean is not consumed until the original bean returns - which implies, I am guesing, until the original message is committed.
    I am open to other patterns. Basically I am trying to understand how to use MDB's to handle synchronous message traffic (powers higher than me dictate the use of JMS, even though it is designed for async processing).
    By synchronous, I mean:
    send a message
    wait X milliseconds for a response
    if got response, do happy stuff
    else report back timeout
    This is a very common service pattern and servlets do it just fine, but I'm stuck with JMS.
    I am a novice at Java EE (except servlets) so I may be asking the wrong questions. I am about to post a question that simply asks how to annotate a BMT MDB. Maybe that will help.
    Ideas?

Maybe you are looking for

  • How to put a variable column value in a "vlookup"

    Hello there, I am trying to put a variably chosen column value in a "vlookup" function. Logically this should work, but it does not, and I cannot figger out why.: "=vloookup("a", B5:Z28, {=MATCH(4, B4:Z4, 0)})" (replaced brackets with {} for this pos

  • A/C problem (?)

    My computer is 6 months old. Last week I plugged in the charger to charge up the battery. At first, the charger was orange and was charging like normal. five minutes later, the charger would flicker between orange and green every two seconds or so...

  • Aol mail 2 inches wide

    why is the aol mail page 2 inches wide I have no idea how long this has been going on, I'm on my fathers computer and I don't use aol. When I tried to bring up his mail the page came up two inches wide. Then when you click on another tab the aol mail

  • How to stop MacKeeper from opening in safari

    I have recently been having MacKeeper and Get a Faster Mac with TuneupMyMac opening in tabs within safari. How can I stop tho happening?

  • Mustek ScanExpress A3 USB wide format scanner - any experiences?

    Greetings. At $200 (new) this looks too good to be true. As usual, they barely mention Mac interface, but they do say that it works with OS 9 (not OS X). Thanks for your time! Regards from sunny Vermont, where Spring has finally arrived.