uCosminexus Service Platform, Basic Development Guide

[Contents][Glossary][Index][Back][Next]

8.5.3 Creating JMS Messages

To send a service component execution request to the standard asynchronous reception (MDB (WS-R)), create a QueueSender object and a JMS message, and send the created JMS message to the transmission queue. For details about developing an application for sending JMS messages, see the manual Cosminexus Application Server Cosminexus Reliable Messaging.

To create a JMS message:

  1. Define a startup process (lookup) for QueueConnectionFactory and Queue.
    Example:
     
    Context ic = new InitialContext();
             ...
    QueueConnectionFactory qcFactory
          = (QueueConnectionFactory) ic.lookup("java:comp/env/jms/qcf");
             ...
    Queue queue = (Queue) ic.lookup("java:comp/env/jms/queue");
             ...
     
  2. Create QueueSession.
    Example:
     
    QueueSession qSession
        = qConnection.createQueueSession(true, Session.AUTO_ACKNOWLEDGE);
     
  3. From QueueSession, create QueueSender.
    Example:
     
    qSender = qSession.createSender(queue);
     
  4. From QueueSession, create a JMS message.
    Example: When the request message is in XML
     
    TextMessage textMessage = qSession.createTextMessage();
     
    Example: When the request message is binary
     
    BytesMessage bytesMessage = qSession.createBytesMessage();