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/

Similar Messages

  • 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.

  • 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
              

  • TemporaryQueue communication - Request/Response messaging in JMS

    Not able to make simple JMS application with the following steps run
    Start the Server
    Start the Client
    The Client creates a temporary queue and sends the name to the server
    Server receives message and sends a test message back.
    Client NEVER receives the test message
    Can someone provide me appropriate sample example in this regard. Using "oc4j_extended_101320"
    Thanks
    sunder
    Note the server recives the request and logs the message
    but client doesnt consume the message.
    Here is client code
    package project1;
    import java.rmi.*;
    import java.util.*;
    import javax.jms.Connection;
    import javax.jms.JMSException;
    import javax.jms.MapMessage;
    import javax.jms.Message;
    import javax.jms.MessageConsumer;
    import javax.jms.MessageListener;
    import javax.jms.MessageProducer;
    import javax.jms.Queue;
    import javax.jms.QueueConnection;
    import javax.jms.QueueConnectionFactory;
    import javax.jms.QueueSender;
    import javax.jms.QueueSession;
    import javax.jms.Session;
    import javax.jms.TemporaryQueue;
    import javax.jms.TextMessage;
    import javax.naming.*;
    public class TestClient {
    private QueueSender sender;
    private Session session;
    private Connection connection;
    private MessageConsumer consumer;
    private MessageProducer producer;
    * Constructor: Setup JMS for publishing
    public TestClient() {
    try {
    Context ctx = getInitialContext();
    System.out.print("env " + ctx.getEnvironment());
    QueueConnectionFactory conFactory =
    (QueueConnectionFactory) ctx.lookup("jms/QueueConnectionFactory");
    Queue chatQueue = (Queue) ctx.lookup("jms/TestQueue");
    // Create a JMS connection
    connection = conFactory.createConnection();
    // Create a JMS session object
    session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
    TemporaryQueue replyQueue = session.createTemporaryQueue();
    TextMessage textMsg = session.createTextMessage();
    textMsg.setText( "How r u dude!!!!!!!");
    textMsg.setJMSReplyTo(replyQueue);
    textMsg.setJMSExpiration(40000l);
    System.out.println("\nsender 1 ========== >>>>> " + replyQueue.getQueueName());
    consumer = session.createConsumer(replyQueue);
    System.out.println("sender 2========== >>>>> " + replyQueue.getQueueName());
    System.out.println("sender 2a========== >>>>> \n" + textMsg.getJMSMessageID() +"\n");
    System.out.println("sender 2b========== >>>>> \n" + textMsg.getJMSCorrelationID() +"\n");
    producer = (MessageProducer) session.createProducer(chatQueue);
    producer.send(textMsg);
    System.out.println("sender 3a========== >>>>> \n" + textMsg.getJMSMessageID() +"\n");
    System.out.println("sender 3b========== >>>>> \n" + textMsg.getJMSCorrelationID() +"\n");
    } catch(Exception e) {
    e.printStackTrace();
    finally {
    * Method: sendmail(Map mail)
    public void sendmail() throws Exception {
    Message respmessage = (TextMessage )consumer.receive();
    System.out.println("sender 3========== >>>>> " + ((TextMessage)respmessage).getText());
    private Context getInitialContext() throws NamingException {
    Properties env = new Properties();
    env.put(Context.INITIAL_CONTEXT_FACTORY,
    "com.evermind.server.rmi.RMIInitialContextFactory");
    env.put("java.naming.provider.url", "ormi://localhost");
    env.put("java.naming.security.principal", "oc4jadmin");
    env.put("java.naming.security.credentials", "welcome1");
    return new InitialContext(env);
    * Static Method: java com.customware.client.EmailClient to_addr [from_addr] [subject] [body]
    public static void main(String args[]) throws Exception {
    System.out.println("\nBeginning EmailClient\n");
    TestClient client = new TestClient();
    client.sendmail();
    MDB code
    package project2;
    import javax.ejb.CreateException;
    import javax.ejb.EJBException;
    import javax.ejb.MessageDrivenBean;
    import javax.ejb.MessageDrivenContext;
    import javax.jms.Destination;
    import javax.jms.JMSException;
    import javax.jms.Message;
    import javax.jms.MessageListener;
    import javax.jms.MessageProducer;
    import javax.jms.Session;
    import javax.jms.ConnectionFactory;
    import javax.jms.Connection;
    import javax.jms.MapMessage;
    import javax.jms.TextMessage;
    public class MessageDrivenEJBBean implements MessageDrivenBean,
    MessageListener {
    private MessageDrivenContext _context;
    private javax.jms.ConnectionFactory connectionFactory;
    private javax.sql.DataSource dataSource;
    public void ejbCreate() throws CreateException {
    dataSource = ResourceFactory.getInstance().getPricingDS();
    //java:comp/env/jdbc/PricingDS
    connectionFactory = ResourceFactory.getInstance().getPricingRespQueueCF();
    public void setMessageDrivenContext(MessageDrivenContext context) throws EJBException {
    _context = context;
    public void ejbRemove() throws EJBException {
    public void onMessage(Message message) {
    TextMessage msg = null;
    Connection connection = null;
    try {
    if (message instanceof TextMessage) {
    msg = (TextMessage) message;
    System.out.println
    ("Dood Message "
    + msg.getText());
    connection = connectionFactory.createConnection();
    Destination replyDest = message.getJMSReplyTo();
    System.out.println
    ("Dood Reply Queue "
    + msg.getJMSReplyTo());
    String replyMsgId = msg.getJMSMessageID();
    Session session = connection.createSession(true, 0);
    System.out.println("Creating producer!!!!!!!!"+ replyDest);
    System.out.println("Creating consumer!!!!!!!! ID\n\n"+ replyMsgId);
    System.out.println("Creating consumer!!!!!!!!COR ID\n\n"+ msg.getJMSCorrelationID());
    MessageProducer producer = session.createProducer(replyDest);
    TextMessage replyMsg = session.createTextMessage();
    replyMsg.setText("Response Message!!!!!!!! Good Job" );
    replyMsg.setJMSCorrelationID(replyMsgId);
    producer.send(replyMsg);
    System.out.println("Creating producer!!!!!!!!ID\n\n"+ replyMsg.getJMSMessageID());
    System.out.println("Creating producer!!!!!!!!COR ID\n\n"+ replyMsg.getJMSCorrelationID());
    producer.close();
    session.close();
    } else {
    System.out.println
    ("Message of wrong type: "
    + message.getClass().getName());
    } catch (Throwable te) {
    te.printStackTrace();
    finally {
    try{
    if(connection!=null)
    connection.close();
    } catch(Exception e) {
    Message was edited by:
    user565613

    You created a transacted session on the server, and then never committed the transaction. Since the transaction was not committed before the session was closed, it is automatically rolled back as per the JMS spec. Either call commit on the session or use a non-transacted session (e.g., use session-creation paramters of "false, Session.AUTO_ACKNOWLEDGE").
    -Jeff

  • How to 'tunnel' requests/response with servlet?

    Hallo!
    I have the following problem.
    Tomcat is used as ServletEngine. Here should work a servlet for authorization. The web application resides on another webserver.
    After authorization all request go to Tomcat where a servlet should get (via HTTP) the HTML-pages from the other webserver and sends them to the client. The customer wants to act the Tomcat as Server to the client and as client to the other webserver. For me it seems to be some kind of proxy functionality.
    How can I achieve this?
    Kind regards
    Jochen

    Hi,
    I am currently writing almost the same thing. And I have a partial success with something like ProxyServlet. What it does:
    1. creates a URL object
    2. creates HttpURLConnection through the URL
    3. copies servlet's request parameters to the HttpURLConnection's request
    4. copies the HttpURLConnection's response to the servlet's response
    It works, but it is very - very slow.
    I am currently struggling with the Keep-Alive feature in HTTP 1.1 that the remote server sends. If I copy that header onto the response, the client sends another request to the same channel, that is mean while broken - the servet is used only by one to one.
    I am trying to find something like URL Connection pool, but still I am not successful. I am going to try not to trasfer the Keep-Alive headers to the client - perhaps this sort of downgrading Http 1.1 to 1.0 will limit the timeout delays ...
    Did you succeed in your work ?
    Ales

  • How to implement Static Designer Domain

    Hello,
    Can anybody give me a suggestion what's the best way to implement a static (designer) domain.
    For example the domain YESNO:
    Value in Database | Display Value on Screen(in poplist)
    Y | Yes
    N | No
    Thanks in advance
    Regards Erik

    Sorry for not being complete,
    I'm trying to create JSF pages (ADF). I created a fixed list. In the binding of the item I see
    <ValueList>
    <Item Value="Y"/>
    <Item Value="N"/>
    </ValueList>
    but I want something like
    <ValueList>
    <Item Value="Y" Meaning="Yes"/>
    <Item Value="N" Meaning="No"/>
    </ValueList>
    Regards Erik

  • Request Response Receive Port and Solicit Response Send Port

    Can anyone give me some idea how to bind Request Response Receive Port and Solicit Response Send Port with each other through TCP/IP adapter ??

    The binding of a Receive and Send Port has nothing to with the choice of Adapter.
    1) There is no out-of-the-box TCP/IP Adapter for BizTalk, but several 3rd. Party Adapters has been made, along with this one in CodePlex: http://tcpipbz2010.codeplex.com/
    2) Most people will use an Orchestration for binding a SR Send Port to a RR Receive Port. This may not be necessary though. All you need to do is have your Send Port subscribe to your Receive Port (by setting the Filter on the Send Port to "BTS.ReceivePortName
    == [The name of your Receive Port]". In this case, internal correlation will make sure that the response is routed back to the Receive Port.
    Morten la Cour

  • How to Implement HTTP Request Status Code Processing

    I actually have two questions. First, I wondering how to add multiple status code processing to an http request. Secondly, I was wondering how to go about using alternate http requests to different servers in case the primary server is down. What kind of parameter would the program use to determine that the server is unavailable and switch to another server??
    Currently, the program I've written calls an rdf server (http://www.rdfabout.com/sparql) using a sparql query,
    the server returns an xml string, the program parses it, and calculates numbers
    from the string. The program works, but the problem is that the server is down occasionally.
    When the server is down, we need to add calls to another server to
    increase reliability. So, the next task is to call this server:
    http://www.melissadata.com/lookups/ZipDemo2000.asp
    I need to do exactly the same things I did with the rdf server. The
    difference will be constructing a request and a bit different parsing of
    the response.
    current SPARQL query is defined as follows:
    PREFIX dc:  <http://purl.org/dc/elements/1.1/>
    PREFIX census: <http://www.rdfabout.com/rdf/schema/census/>
    PREFIX census1: <tag:govshare.info,2005:rdf/census/details/100pct/>
    DESCRIBE ?table WHERE {
    <http://www.rdfabout.com/rdf/usgov/geo/census/zcta/90292> census:details
    ?details .
    ?details census1:totalPopulation ?table .
    ?table dc:title "SEX BY AGE (P012001)" .
    }current HTTP Request is defined as follows:
    import java.net.*;
    import java.net.URL;
    import java.net.URLConnection;
    import java.io.*;
    import java.io.DataOutputStream;
    import java.io.BufferedReader;
    import java.io.StringReader;
    import java.io.InputStreamReader;
    import java.io.PrintStream;
    import java.util.Scanner;
    import java.util.regex.Matcher;
    import java.util.regex.Pattern;
    import java.util.Arrays; 
    public class MyConnection
         static Scanner sc = new Scanner(System.in);//allows user to input zipcode
        public static void main(String[] args) throws Exception
             int zip;//zipcode is declared as integer format
            //User defines zip through input
            //proceed to put SPARQL query into string, which is then used to call the server
            String requestPart1 =
            "query=PREFIX+dc%3A++%3Chttp%3A%2F%2Fpurl.org%2Fdc%2Felements%2F1.1%2F%3E+%0D%0APREFIX+census%3A+%3Chttp%3A%2F%2Fwww.rdfabout.com%2Frdf%2Fschema%2Fcensus%2F%3E+%0D%0APREFIX+census1%3A+%3Ctag%3Agovshare.info%2C2005%3Ardf%2Fcensus%2Fdetails%2F100pct%2F%3E+%0D%0A%0D%0ADESCRIBE+%3Ftable+WHERE+%7B+%0D%0A+%3Chttp%3A%2F%2Fwww.rdfabout.com%2Frdf%2Fusgov%2Fgeo%2Fcensus%2Fzcta%2F";
            String requestPart2 = "" + zip; // zipcode is transformed from int to string format and plugged into SPARQL query here
            String requestPart3 =
            "%3E+census%3Adetails+%3Fdetails+.+%0D%0A+%3Fdetails+census1%3AtotalPopulation+%3Ftable+.+%0D%0A+%3Ftable+dc%3Atitle+%22SEX+BY+AGE+%28P012001%29%22+.+%0D%0A%7D%0D%0A&outputMimeType=text%2Fxml";
            String response = "";
            URL url = new URL("http://www.rdfabout.com/sparql");//designates server to connect to
            URLConnection conn = url.openConnection();//opens connection to server
            // Set connection parameters.
            conn.setDoInput (true);
            conn.setDoOutput (true);
            conn.setUseCaches (false);
            // Make server believe we are form data…
            conn.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
            DataOutputStream out = new DataOutputStream (conn.getOutputStream ());
            // Write out the bytes of the content string to the stream.
            out.writeBytes(requestPart1 + requestPart2 + requestPart3);
            out.flush ();
            out.close ();
            // Read response from the input stream.
            BufferedReader in = new BufferedReader (new InputStreamReader(conn.getInputStream ()));
            String temp;
            while ((temp = in.readLine()) != null)
                 response += temp + "\n";
            temp = null;
            in.close ();
            //parsing stuff is taken care of after here
    }What remains now is to:
    1) add status code processing: notify if the server is not available, ect.
    2) add ability to connect to additional server if primary server is down.
    I'm thinking an if/else statement, which I've tried a few different ways,
    but I don't quite know how to implement that...Also trying to add the
    status code processing/error handling, but I'm not sure how to do that
    for multiple/different errors, such as 404, 503, 504, ect.. try/catch statements?
    So yeah, just been scratching my head on this trying to figure out how to work it..
    If you can help me out on this, I've been going nuts trying to figure this out...

    I think your issue comes form the fact that you are not casting URLConnection to HttpURLConnection.
    Doing the cast would allow you to use getResponseCode() - among other methods - and test for a response different than 200.
    Read: [http://mindprod.com/jgloss/urlconnection.html|http://mindprod.com/jgloss/urlconnection.html]

  • How to implement the Seibel response in the ADF ?

    Hi All,
    JDev ver : 11.1.1.5
    I have integrated the Fusion middle ware with Seibel using the 'REST' services(The URI based service).
    I followed this link to integrate : http://siebel-essentials.blogspot.com/2011/02/first-encounter-with-sai-ofm.html
    I want to know how to use the response and how can I implement the URI response in my java/ADF code ?
    How to send the request ? and how to receive the response ?
    If anyone worked on this, please share me the implementation process..
    Regards,
    Gopinath

    Hi,
    JDeveloper 11.1.1.5 supports REST get requests from the URL Data Control (if you wanted to use ADF). Note however that this release expects an XML or CSV payload. Alternatively you build a REST client using Jersey libraries in which case the client is a Java object that then you use to provide the data for display
    Frank

  • Request and Response Scenario for JMS adapter

    Hi,
    I am working on IDOC-XI-JMS, JMS(sender)- XI - JMS (receiver)scenario and this is going to be real time. If any record is update in customer master then that record will be sent to JMS provider MQ series and lock the record in the legacy system and then legacy system unlock and send back a message that this has been unlocked.
    This would be request response message, anyone tell me how this can be achived. I think I may have to use BPM for this kind of processing. Can anyone tell me the steps to achive the BPM for such processing.
    Regards
    Please reply back
    Edited by: hema Mehta  on May 23, 2008 2:05 AM

    Hi Hema,
    Reward points if this helps
    Step by Step Porcess of JMS Synchronous Scenario without BPM: Correlation Settings and Transactional JMS Session
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/b028f6f6-7da5-2a10-19bd-cf322cf5ae7b
    How To Correlate JMS Messages
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/8060448a-e56e-2910-f588-9af459e7ce21
    Async/Sync Communication using JMS adapter without BPM
    /people/sudheer.babu2/blog/2007/01/18/asyncsync-communication-using-jms-adapter-without-bpm-sp-19
    STEPS in BPM for synchornous.
    Reward points if this helps
    Regards
    Pragathi.

  • 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

  • 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

  • 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

  • How to implement a domain?

    Hi,
    1 virtual network(192.168.0.x/24). 1 subnet: 192.168.0.4 to 192.168.0.254. 2 DNS Servers: 192.168.0.4 and 100.75.116.100 (DNS address when a new VM is created).
    I have 10 VMs. 1 DC. By powershell the VMs has been set static IP addresses (the DC is 192.168.0.4)
    The VMs were domain joined.
    The problems are:
    very slow or null internet speed (when the VM is new, the internet speed is fast).
    domain joining using netbios name is impossible (need to use FQDN name for domain joining OK)
    when domain joining a VM, occurs the following error(first welcome message, the error message):
    The questions are:
    How to implement a domain and mantain fast internet?
    Is normal behavior the above error at domain joining?
    Thanks in advance!

    Hi
    Joining a domain should not affect your internet connection.
    Try removing the second DNS address and see if your machine joins the domain.
    Hope this helps. Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

Maybe you are looking for