MDB sending a JMS message to a queue (WLS 8.1.4)

We are trying to implement a MDB to send a JMS message to a dynamically created JMS queue. Is this possible? We have found documentation stating the JMS Queue destination needs to be in the deployment descriptor, but in our case it changes so this is not an option. Any help would be appreciated.

Sorry I didn't address the answers more clearly. You were correct on the answers except with:
          Switch from using a resource-reference to a direct reference for a send? Answer: No. We are only trying a direct send, not utilizing the resource-reference.
          We are already using "false" for the connection.create[Queue]Session code.
          Should we be trying something else because of transactional behavior of not utilizing the resource-reference for the send as you thought?
          We have tried the queue as XA and non-XA and neither work.

Similar Messages

  • How to send a JMS message to a server ....

    Hi
    I want to know how to send a jms message to a Queue and that is in a different server...
    How to send A message using a application client to a Message queue That is in another Machine(Server is in another machine )
    env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.cosnaming.CNCtxFactory");
    env.put(Context.PROVIDER_URL, "iiop://127.0.0.1:3700/");
    InitialContext initialContext = new InitialContext(env);
    connectionFactory = (ConnectionFactory) initialContext.lookup("jms/ConnectionFactory");
    queue = (Queue) initialContext.lookup("jms/Queue");
    get a NameNotFoundException
    Anyone have an Idea
    thanks
    Ishkmi
    Message was edited by:
    ishkmi

    ok..try this..insert the ip address of the server where ur app server is
    running . i understand ur client and server is running on diff machines.
    ip address 127.0.0.1 is for local host. it tries to look for the server in
    same system as the client.
    substitue ip address of server in below line instead of 127.0..0.1
    env.put(Context.PROVIDER_URL, "iiop://127.0.0.1:3700/");
    best of luck ..lemme know..

  • Sending a JMS message inside a PostPersist entity listener method

    Hi to all,
    I have an entity called "Batch" that I want to persist. After the persist, I want to send a JMS message to notify batch insertion to the other clients.
    So I created the "Batch" entity as following :
    @Entity
    @EntityListeners({BatchServiceBean.class})
    @Table(name = "batch")The "BatchServiceBean" is a session bean which persists the batch and sends the JMS notification message.
    Inside this class we have the following method :
    @PostPersist
        private void sendInsertMessage(Batch insertedBatch) throws JMSException {
            AddBatchMessage message = new AddBatchMessage();
            message.setBatch(insertedBatch);
            try {
                messageSenderServiceBean.sendRefreshMessage(message);
            } catch (Exception oups) {
                oups.printStackTrace();
        }In the previous code, I recuperate the inserted batch and the "messageSenderServiceBean" facade to send a refresh message.
    My problem is that I can get the inserted batch, but the object "messageSenderServiceBean" is null knowing that I have the following annotation to get the "messageSenderServiceBean" facade.
    @EJB
        private MessageSenderServiceLocal                   messageSenderServiceBean;Whyhe object "messageSenderServiceBean" is null ??
    Can any one help me ??
    Thanks in advance.

    Hello,
    Injection only occurs on server managed objects, not JPA managed entities or other java objects such as the listeners registered with JPA. So your Listener class will need to look up the server objects or other resources directly from the context rather than rely on them being injected. I don't have any good examples handy, but similar to how you would look up an ejb/datasource etc before injection.
    Best Regards,
    Chris

  • How to send a JMS message to a remote Queue?

    Hi,
    I know how to create a JMS message and send it to an MDB that listens to a topic in the same container in which the JMS is created.
    In other words, if I have the following MDB:
    @MessageDriven(mappedName = "jms/MyQueue", ...)
    public class MyMDB implements MessageListener {
    Elsewhere in my JEE app I can create a Queue like this:
    @Resource(mappedName = "jms/MyQueue")
    Queue queue;
    and use it to send a message to the MDB.
    But How can I send a message to an MDB that's deployed in another app server on another machine in the network? Both of the app servers are Glassfish.
    Thanks in advance.
    Edited by: EJP on 9/08/2011 21:49: fixed your meaningless title

    Hi,
    The first thing I would like to suggest is, we never/can't send message directly to MDB. We always send/receive message(s) to/from the destination. In case of MDB, the application server register the MDB as message listener against particular destination, and invoked the onMessage() method when message arrives on particular destination.
    If I am not wrong, what you want to achieve is asynchronous communication between two applications deployed in two different machine. In your case, you want your one application works as message producer and other act as an message consumer, and both are deployed in different machine.
    In this situations, you only need to configure the JMS administration object, connection factories and destinations, on one Application server and configure other application server to use those configuration using JMS resource adapter. you can well achieve this by configuring the JMS Resource Adapter. you need to check the Glassfish documentation.
    If you don't want to break the JMS specification, always communicate with Messaging Provider through Resource Adapter.
    I hope this helps.

  • JMS messages stuck in queue in weblogic v923 cluster

    Hi all,
    Enviornment details:
    In our pre-production weblogic v923 cluster enviornment with Oracle 10g database, there are 10 server boxes with 2 managed nodes running on each server box in linux enviornment.
    There are 3 JMS queues and 1 error queue per managed node.
    All the queues are durable and the persitence store is a database table. There is a single database table per single managed node.
    High loads of JMS messages from client applications coming on each of the 3 JMS queue are processed by the cluster on daily basis.
    The JMS messages that failed to be processed the very first time due to the application logic exceptions are put on error queue since the retry is set to zero on the non-error queue.
    The application exceptions are logged to a database table for futher reference.
    The falied messages from the error queue are read by spring based MDP and resent to the application for reprocessing.
    If no application exceptions, the message will be persisted in a relational database; in the case of failures, MDP code puts the failed message back on to the error queue.
    The auto_ack is true on the JMS message.
    It is observed about less than 1% of the messages fail the original processing and are in error queue on daily basis.
    99.9% of the time, the reprocessing of the messages from the error queue is a success.
    Currently due to some obvious reasons, the system administrator stops a managed node when the disk is full and start a different managed node on the same server box. This approach will be stopped in the very near future so that all nodes on all servers are running at any point of time by making few enviornment changes.
    Problem:
    1a) Occasionally, it is observed that 1 - 4 JMS messages are stuck in the error queue. There are no signs of reprocessing as there are no application exceptions or the corresponing insert into the database. The JMS persistence store table still has the JMS message.
    1b) It is observed that over time, the same JMS messages that were originally stuck on server 1's managed node A are no longer there but are found in a different node (say node B) on a different server box.
    As far as I understand the JMS, a message could be in a Pending state if MDP (in my case) does not automatically send ACKNOWLEGMENT back due to an issue in the Spring Defaultlisternercontainer before calling MDP's onMessage(). I am not sure as what happens to that status over time).
    It is also observed that the stuck messages content is not much different than the other messages that are processed fine.
    Any pointers/input is highly appreciated.
    Thanks in advance for your valuable input and time.

    Off the top of my head, I can only think of two reasons why a message might move from node to node:
    (A) An application is dequeueing them and enquening them elsewhere.
    (B) The application is using distributed queues, and the distributed queue has been configured to enable "queue forwarding". The forwarding feature automatically moves messages from distributed queue members that have no consumers to members that do have consumers. Queue forwarding is sometimes enabled as a work-around to better enable MDP support of WL distributed destinations, unlike WebLogic MDBs, MDPs have no container logic to ensure that all members of a distributed destination are serviced by a consumer under all circumstances...
    Regards,
    Tom

  • Routing JMS message from same queue to different channels.

    From a given adapter module, is there a way of calling different communication channels?
    The scenario: The sender of the data is JMS. One single queue contains desperate text format. Based on the content of the first 4 characters , PI has to parse it differently in its own corresponding MT. The target IDoc structure remains the same. I have multiple messageTransformBeans set up, one for each MT assuming that the data would arrive in different JMS queues. However since the data is now all heaped on to a single queue, the challenge of routing the data now lies in SAP PI.
    HowTo - Send Test Messages to the Adapter Engine (to an Integrated Configuration) - This solution does send message directly to the IE (using 7,1), but not to the adapter engine where the messageTransformBeans exist.
    Any solid pointers in the direction will be really helpful.
    Regards,
    Keerti

    Hi,
    you can go for end to end testing.
    if jms not available use file adapter in the sender side and fetch the text file and test it.
    Regards,
    Muni

  • Can the AQ Adapter send a JMS Message?

    I'm trying to use the AQ adapter to enqueue an XML message into a queue who's payload type is AQ$JMS_TEXT_MESSAGE so that it can be consumed by a Message Driven Bean in OC4J.
    Simply sending the XML reults in:
    "AQ Adapter: ** Error ** Can not enqueue messages to queue PLEDGE. ADT Payload defined for Queue PLEDGE does not match with OAI Message. Please check attribute "Pledge". In order for the AQ Adapter to enqueue OAI messages to the queue, the queue payload must match the ADT imported through iStudio."
    I tried importing the AQ%JMS_TEXT_MESSAGE but can't see any easy way to construct it.
    Is this even possible?
    -Doug

    Doug,
    the AQ$JMS_TEXT_MESSAGE is an object type. So you'll need to import that type as your application view.
    The problem with this JMS objecttype is how to populate it.
    When your text (XML) is more than 4000 characters in length, the TEXT_LOB attribute should get the text. If less, the TEXT_VC attribute should get the text. In any case, the TEXT_LEN should be set to the length of the XML.
    AFAIK, you can't currently do this with InterConnect directly.
    The most popular solution is to have InterConnect deliver this message to a simple non-JMS queue and have some PL/SQL or java code convert it to a proper JMS text message and put it in the JMS text queue.
    There are some features in the DBMS_AQ package to register a plsql procedure to be triggered when a message arrives (dbms_aq.register). That could be a procedure which converts the message for you.
    In ProcessConnect (coming soon) there is a dedicated JMS adapter available.
    HTH, Marc

  • Sending/Receiving JMS message to WMQ from Automated Task

    Hi All,
    I am new to OSM and working on a POC for the implementation of OSM in our company. We have WebSphere MQ for messaging and want to use same for OSM implementation. We don't want to create bridges, foreign server etc configuration in weblogic, rather just connect with MQ objects over JNDI (as supported) from OSM automated task. Having said that, we have following two scenarios:
    1- JMS message is received at OSM
    2- JMS message initiated from OSM (automated task)
    Now our requirement is to create a sort of JMS inbound gateway for first scenario i.e. reading a message from a Queue and CreateOrder and then reply back to caller using JMSReplyTo header.
    Second as JNDI support is available for automated task, can we send JMS message using direct JNDI look up for MQ JNDI objects i.e. using .bindings file (JNDI URL for MQ objects).
    Thanks

    Hi All,
    I am new to OSM and working on a POC for the implementation of OSM in our company. We have WebSphere MQ for messaging and want to use same for OSM implementation. We don't want to create bridges, foreign server etc configuration in weblogic, rather just connect with MQ objects over JNDI (as supported) from OSM automated task. Having said that, we have following two scenarios:
    1- JMS message is received at OSM
    2- JMS message initiated from OSM (automated task)
    Now our requirement is to create a sort of JMS inbound gateway for first scenario i.e. reading a message from a Queue and CreateOrder and then reply back to caller using JMSReplyTo header.
    Second as JNDI support is available for automated task, can we send JMS message using direct JNDI look up for MQ JNDI objects i.e. using .bindings file (JNDI URL for MQ objects).
    Thanks

  • Sending a jms message from one server to another in a cluster fails..

    Hi,
              My platform is wl6.1 sp7 two servers in a cluster...
              I have problems sending jms messages from one server to the other. When sending to a destination on the same server it works fine, but sending to the other server do not work. I get no exceptions when I send the message. The "Monitor all Active JMS Destinations..."->"Messages Received" column increase number of received messages for the remote server. But the onMessage method in the bean is not called(I am logging all calls to a file...)
              Any suggestions?
              And..
              My understanding is that the JNDINameReplicated default value is set to true? But when I don't set this value to true the jndi name is not replicated too the other server.
              (The state for both servers are Running in the admin console and listed servers in the cluster is 2....
              Server names:
              * bluej, biztalk-lab
              JMS connection factory:
              * xlink.jms.factory.commerceFactory, deplyed on both servers and for the cluster
              Destinations:
              * xlink.jms.service.report.biztalk-lab.Report for the biztalk-lab server active on 'biztalk-labJMSServer' JMS-server
              * xlink.jms.service.report.bluej.Report for the bluej server active on 'bluejJMSServer' JMS-server)
              ~b

    Deployed to the bluej server:
              <weblogic-ejb-jar>
              <weblogic-enterprise-bean>
              <ejb-name>xlink.jms.service.report.bluej.Report</ejb-name>
              <message-driven-descriptor>
              <pool>
              <max-beans-in-free-pool>3</max-beans-in-free-pool>
              <initial-beans-in-free-pool>1</initial-beans-in-free-pool>
              </pool>
              <destination-jndi-name>xlink.jms.service.report.bluej.Report</destination-jndi-name>
              </message-driven-descriptor>
              <jndi-name>xlink.jms.service.report.bluej.Report</jndi-name>
              </weblogic-enterprise-bean>
              <weblogic-enterprise-bean>
              <ejb-name>xlink.jms.service.report.bluej.Report</ejb-name>
              <message-driven-descriptor>
              <destination-jndi-name>xlink.jms.service.report.bluej.Report</destination-jndi-name>
              </message-driven-descriptor>
              <jndi-name>xlink.jms.service.report.bluej.Report</jndi-name>
              </weblogic-enterprise-bean>
              </weblogic-ejb-jar>
              <ejb-jar>
              <enterprise-beans>
              <message-driven>
              <ejb-name>xlink.jms.service.report.bluej.Report</ejb-name>
              <ejb-class>no.xlink.server.service.report.engine.jms.ReportBean</ejb-class>
              <transaction-type>Bean</transaction-type>
              <message-driven-destination>
              <destination-type>javax.jms.Queue</destination-type>
              </message-driven-destination>
              </message-driven>
              </enterprise-beans>
              </ejb-jar>
              Deployed to the biztalk-lab server:
              <weblogic-ejb-jar>
              <weblogic-enterprise-bean>
              <ejb-name>xlink.jms.service.report.biztalk-lab.Report</ejb-name>
              <message-driven-descriptor>
              <pool>
              <max-beans-in-free-pool>3</max-beans-in-free-pool>
              <initial-beans-in-free-pool>1</initial-beans-in-free-pool>
              </pool>
              <destination-jndi-name>xlink.jms.service.report.biztalk-lab.Report</destination-jndi-name>
              </message-driven-descriptor>
              <jndi-name>xlink.jms.service.report.biztalk-lab.Report</jndi-name>
              </weblogic-enterprise-bean>
              <weblogic-enterprise-bean>
              <ejb-name>xlink.jms.service.report.biztalk-lab.Report</ejb-name>
              <message-driven-descriptor>
              <destination-jndi-name>xlink.jms.service.report.biztalk-lab.Report</destination-jndi-name>
              </message-driven-descriptor>
              <jndi-name>xlink.jms.service.report.biztalk-lab.Report</jndi-name>
              </weblogic-enterprise-bean>
              </weblogic-ejb-jar>
              <ejb-jar>
              <enterprise-beans>
              <message-driven>
              <ejb-name>xlink.jms.service.report.biztalk-lab.Report</ejb-name>
              <ejb-class>no.xlink.server.service.report.engine.jms.ReportBean</ejb-class>
              <transaction-type>Bean</transaction-type>
              <message-driven-destination>
              <destination-type>javax.jms.Queue</destination-type>
              </message-driven-destination>
              </message-driven>
              </enterprise-beans>
              </ejb-jar>

  • Can 1 MDB configured to receive messages from 2 Queues

    Hi,
    Is is possible to configure 1 MDB to listen to 2 queues

    Deploying the very same MDB twice is not a "trick" or unusual as your comment suggests. A MDB is a stateless component. It just receives messages. If you deploy the same MDB twice and link it to different queues, it is exactly as if one MDB where configured to receive from 2 queues.
    So everything is possible with MDBs. You can consume from multiple destinations and can even mix queues and topics. The only thing you must keep in mind is that you have at least that many MDB instances (of the same MDB) as destinations (= MDB deployments). However, for scalability reasons you would have multiple MDB instances in most cases.
    I don't see a reason why sombody should switch to a proprietary thing like your MDS and I don't understand why you mention this in nearly every post. Buy banner ads instead.
    -- Andreas

  • PeerGoneException sending large JMS messages using T3.

    Hello,
              I'm using WL 7.0 SP4 on the backend. I have clients that send JMS messages to this WL server using T3. Some of the messages are ~1MB in size, and sometimes the clients use dial-up connections with a maximum speed of 54 Kbps. (Yes, I know we are living in the dark ages...)
              Anyway, sometimes the WL server throws a PeerGoneException. I realize this is because the CompleteT3MessageTimeout has expired. I have already set it to the maximum of 480 seconds, but sometimes that's not enough. Is there a way to disable this timeout or set it to be infinite?
              Does anyone have any suggestions?
              thanks in advance,
              matt

    sorry for answering myself...
              if you set 480 seconds on client and on server side, you will get a time
              range of 480 seconds.
              you will never be able to get more then 480 seconds. (And yes, there
              only existe the T3MessageTimout, which should be fine to my point of view.
              Another point might be the jta transaction timeout server-side.
              Regards
              Klaas
              Klaas Hagemann schrieb:
              > Hi Matt,
              >
              >
              > the settings have to be the same, client- and serverside. The whole t3
              > connection times out.
              > I only tested it with 8.1, so i cannot give you any advice concerning 7.0.
              > Maybe you should contact BEA Support, they should easily be able to
              > check whether there exists a patch for 7.0
              >
              >
              > Sorry...
              >
              >
              > Klaas
              >
              >
              > Matt Hill schrieb:
              >
              >>Thanks for the reply, Klaus.
              >>
              >>We are using WL 7.0 (not 8.1), so we do not have the CompleteMessageTimeout attribute. WL 7.0 only has the CompleteT3MessageTimeout attribute, which I set to the maximum of 480 secs, but unfortunately it sometimes takes longer to transfer our messages.
              >>
              >>I tried your suggestion of setting the client-side java property, but it did not help. I believe my problem is that the server times out - not the client.
              >>
              >>Any other ideas would be greatly appreciated.
              >>
              >>thanks,
              >>matt

  • Can' t consume JMS messages from remote queue

    Hello.
    We are using Tibco JMS Server as Foreign JMS server from WL server. And WebLoigic (8.1 SP 3) MDBs are receivers. Everything works fine until there is a restart of the Tibco server. Once the queues become unavailabe, we see in the WL log that the destination is unreachable. And also once the Tibco server comes back up, WL log says that the Foreign queues have been re-connected. But still, we don't see any messages being received by the MDB. The MDBs are configured to poll for messages evey 1 second. Still we don't see it happening after the foreign server restart.
    But if we re-start the WL server, it begins to work just fine.
    Any pointers?
    Thanks

    I do have the correct IP address of the syslog server set up. I do not want email logs so have not enabled that.
    My setup is
    remote lan > SA520-remote (192.168.160.1) > [ site to site IPSec VPN over WAN ] > SA520-local (192.168.150.1) > syslog server (192.168.150.25) & local lan
    Firewall is set up to allow ANY IN & OUT to local lan on both routers.
    I have also set up specific rules for UDP 514 Syslog traffic (no difference, currently disabled)
    syslog server has -no- firewall at the moment.
    Syslog server is receiving messages from the local router with no issues.
    Log Severity is set to Information &  Log Facility is set up to send to Syslog.
    I have also setup a SNMP trap on the syslog server & pointed the remote router to it in hopes of diagnosing the issue.
    Both routers have the latest firmware applied.
    Using wireshark on the syslog server I see no traffic on UDP 514 (syslog) or UDP 162 (snmp)
    I can use the WUI for the remote & ping the 160.1 with no problem. Both ping & TLS/TCP traffic show up in wireshark on the syslog server when I do so.
    It looks to me like there is a problem routing the syslog messages out of the router & then back through the VPN.
    Worst case I'll set up another syslog server on an old machine at the remote location & then cron the logs to the central syslog server but it really seems I shouldn't have to.

  • Error reading jms message from MQ-queue

    Hi,
    To be able to use async-sync bridge in JMS adapter, we recently patched XI 3.0 from SP 15 to SP21. But the jms sender adapter has problem reading the message from the MQ-queue, see detail of error-message at the end of this message.
    I did change the adapter to use modules use RequstResponseBean and ResponseOneWayBean as explaned on help.sap.com.
    The async-sync bridge worked once and the it started failing.
    Detailed error message in communication channel monitoring:
    Error while processing message '3c5a0640-9c03-11dc-82f2-000255d3bbf7';  detailed error description: com.sap.aii.adapter.jms.api.channel.filter.MessageFilterException: Could not begin a AF transaction: TxManagerException: Unable to open transaction: com.sap.engine.services.ts.exceptions.BaseSystemException at com.sap.aii.adapter.jms.core.channel.filter.TxManagerFilter.filterSend(TxManagerFilter.java:103) ...
    /Maria Lande

    Hi,
    I fixed it myself. I hade to do a Xi Data Cahe Refresh.
    Navigate to Administration section on the SAP Exchange Infrestructure start page. On the Directory tab page, choose Cache overview under the heading Administration of Locks and Caches. Do a Full Cache Refresh on the adapter engine.
    /Maria Lande

  • Sending a JMS message from a Servlet

    Hello All
    I�m using the Sun Java Sysytem Application Server and have been trying to implement a servlet which on receipt of a Post message, takes the message and sends it using JMS to a message queue. I�m developing my first web application so all is fairly new to me but I desparately need to know if this scenario is viable. I have worked through relevant sections of the Java EE5 tutorial and so have the required ConnectionFactory and Queue resouces in place. I located the code below which the author implemented in Eclipse 3.2 and have tried to run it to establish that messages can be successfully sent. The code compiles ok but after the post message has been sent the server appears to lock up.
    The servlet is as follows:
    import java.io.IOException;
    import javax.annotation.Resource;
    import javax.jms.Connection;
    import javax.jms.ConnectionFactory;
    import javax.jms.Destination;
    import javax.jms.JMSException;
    import javax.jms.MessageProducer;
    import javax.jms.Queue;
    import javax.jms.Session;
    import javax.jms.TextMessage;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    public class NewServlet extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet {
    @Resource(mappedName = "jms/Queue")
    private Queue queue;
    @Resource(mappedName = "jms/connectionFactory")
    private ConnectionFactory jmsConnectionFactory;
    //private Connection connection;
    public NewServlet() {
    super();
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    Connection connection = null;
    Destination dest = (Destination) queue;
    try {
    connection = jmsConnectionFactory.createConnection();
    Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
    MessageProducer producer = session.createProducer(dest);
    TextMessage message = session.createTextMessage();
    message.setText("Hello");
    response.getOutputStream().println("Sending message: " + message.getText());
    System.out.println("Sending message: " + message.getText());
    producer.send(message);
    producer.send(session.createMessage());
    } catch (JMSException e) {
    e.printStackTrace();
    } finally {
    if (connection != null) {
    try {
    connection.close();
    } catch (JMSException e) {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    // TODO Auto-generated method stub
    Please could someone point me in the right direction.
    Many Thanks

    Hello All
    I�m using the Sun Java Sysytem Application Server and have been trying to implement a servlet which on receipt of a Post message, takes the message and sends it using JMS to a message queue. I�m developing my first web application so all is fairly new to me but I desparately need to know if this scenario is viable. I have worked through relevant sections of the Java EE5 tutorial and so have the required ConnectionFactory and Queue resouces in place. I located the code below which the author implemented in Eclipse 3.2 and have tried to run it to establish that messages can be successfully sent. The code compiles ok but after the post message has been sent the server appears to lock up.
    The servlet is as follows:
    import java.io.IOException;
    import javax.annotation.Resource;
    import javax.jms.Connection;
    import javax.jms.ConnectionFactory;
    import javax.jms.Destination;
    import javax.jms.JMSException;
    import javax.jms.MessageProducer;
    import javax.jms.Queue;
    import javax.jms.Session;
    import javax.jms.TextMessage;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    public class NewServlet extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet {
    @Resource(mappedName = "jms/Queue")
    private Queue queue;
    @Resource(mappedName = "jms/connectionFactory")
    private ConnectionFactory jmsConnectionFactory;
    //private Connection connection;
    public NewServlet() {
    super();
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    Connection connection = null;
    Destination dest = (Destination) queue;
    try {
    connection = jmsConnectionFactory.createConnection();
    Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
    MessageProducer producer = session.createProducer(dest);
    TextMessage message = session.createTextMessage();
    message.setText("Hello");
    response.getOutputStream().println("Sending message: " + message.getText());
    System.out.println("Sending message: " + message.getText());
    producer.send(message);
    producer.send(session.createMessage());
    } catch (JMSException e) {
    e.printStackTrace();
    } finally {
    if (connection != null) {
    try {
    connection.close();
    } catch (JMSException e) {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    // TODO Auto-generated method stub
    }Please could someone point me in the right direction.
    Many Thanks

  • EJBs sending multiple JMS messages

              I have two EJBs running on my server. Both EJBs are listening to a JMS topic.
              Upon recieveing
              a message from the topic, the EJBs need to do some processing and then write a
              different
              message to the topic. I would like both EJBs to receive the message (to maintain
              a certain
              state), but I do not want both EJBs to write another message to the topic. That
              causes issues
              because then other subscribers are receiving duplicate messages. Does anybody
              have any
              insight in to what I am trying to do?
              Thanks,
              Joel
              

              Yes, the MDBs are the same but are deployed on different servers in the cluster.
              I want both
              MDBs to have the ability to publish, but not at the same time. I would like the
              one MDB to be
              a failover type of service, in that it only publishes when the other is unable
              to for some reason.
              Tom Barnes <[email protected]> wrote:
              >Why can't one of the MDBs be coded such
              >that it won't publish a message? Are they
              >the same MDB but different deployments?
              >
              >
              >Joel wrote:
              >
              >> I have two EJBs running on my server. Both EJBs are listening to a
              >JMS topic.
              >> Upon recieveing
              >> a message from the topic, the EJBs need to do some processing and then
              >write a
              >> different
              >> message to the topic. I would like both EJBs to receive the message
              >(to maintain
              >> a certain
              >> state), but I do not want both EJBs to write another message to the
              >topic. That
              >> causes issues
              >> because then other subscribers are receiving duplicate messages. Does
              >anybody
              >> have any
              >> insight in to what I am trying to do?
              >>
              >> Thanks,
              >> Joel
              >
              

Maybe you are looking for

  • How can I delete saved messages from my iphone 5s to be able to update it?

    I have needed to update my Iphone 5s from the past 2 updates but it says that I have 4.2 GB of saved messages.  I don't know where to go to delete them.  I delete regular messages from my phone daily so I'm not sure what is being saved and where. Tha

  • How to configure CTS+ for Solution Manager for XI 3.0

    Hi , We are working on XI 3.0 SP 20 and Doing a file system based transport of .TPZ files. We observed that there is a possibilit of misssing the objects while tranporting. So we are planning to set CTS+ with our Solution Manager. Question: 1. Can we

  • Has anyone tried CrossOver Mac?

    If there was a thread about this some where, I missed it. But, I'm just curious if anyone has tried the beta of the new program CrossOver Mac, which allows you to run Windows applications natively in OS X without actually running windows. codeweavers

  • Good Receipt Note

    Hi. can you tell how can i see print preview of good receipt note.

  • Ending drop cap styling after a paragraph return

    I'm working back in the dark ages of CS4 and I'm having an issue with drop caps and my workflow in the office. I have a drop-cap applied to the first paragraph via the Paragraph Style and I have apply next style active. When editors go into the text