MDB Publish to Topic/Queue

Does anyone know if its "bad practice" to have an MDB publish to a Topic or Queue.
Say I have FooMDB listening on Topic1 and I want FooMDB to publish to Topic2 if "somethign happens" or just finish the onMessage if "something else happens". That way when Topic2 recieves the message Foo2MDB receives the message and does its thing.
I have this working but I can't find anything that says I shouldn't do this .... Any thoughts??
Thanks

Hi,
did you try a manual acknowledge? Something like
public void onMessage(Message msg) {
   try {
      msg.acknowledge();
   } catch (JMSException e) {
      // handle it
   }When you create a new QueueSession, you have to set it to
Session.CLIENT_ACKNOWLEDGEIn your case, JMS waits until the complete transaction (even with the
decision what to do, the forward and so on) are done successfully. With
CLIENT_ACKNOWLEDGE you tell JMS you got the message and will
take care of the rest.
-Danny

Similar Messages

  • Multiple Topics/Queue for Single MDB?

    Hi -
    Is it possible to configure single MDB to handle multiple Topic/Queue in JMS? I used two <jndi-name/> tags for two topics, but only the first one got picked up by the AS7 server. If one MDB can be configured to take multiple topics, how should I configure it? Some configuration example would be most helpful.
    Thanks!

    Hello,
    According to the Ejb 2.1 specifications, in section 15.4.12 "Association of a Message-Driven Bean with a Destination or Endpoint.
    A message-driven bean is associated with a destination or endpoint when the bean is deployed in the container. It is the responsibility of the Deployer to associate the message-driven bean with a destination or endpoint."
    Based on this sentence, I would be led to beleive that a single mdb reading on multiple destinations would not be supported. You can try x-posting this to the application server forum.
    If you desire the same behavior for the multiple topics, you could always use inheritance on your mdb class, or transfer the logic code into a helper class that is reused by multiple, independent MDBs classes....

  • MDB as a topic subscriber

    Hi,
    I am a little confused as to how would i bind a MDB on a topic.
    Usually any MDB implements Message Listener interface and hence we write the implementation for OnMessage method.
    I have succesfully writen to make MDB listen to a queue, but i am confused about the same for topic. Usually for the topic, the client who is listening to the topic needs to implement startListener() ... now the startListener() has to be called/invoked by somebody.
    In my case i want an MDB to start listening to a topic on another Server, how can i do this ?
    I did quite alot of search on net but didnt come up with what i needed ?
    Code snippets are very much appreciated, even a small tutorial ...
    TIA
    Meka Toka

    Let me be more clear,
    I implemented a Topic, where an application client is listening to a Topic, and the message is being published by an ejb on a server. In this scenario i wrote a message listener class on the client side, i had a start listener method, in which i would do the lookup, create topic connection and start the listener. And the start listener method had to be called/invoked, then only the client would listen to the topic.
    If i wanted a MDB to listen to topic, do i need the startlistener method ??
    if Yes, who invokes the method ?
    if NO, does it mean the MDB is directly bound to the topic ?
    Now MDB has an OnMessage() method, in which we write what to do after u get the message ? But my question is how to bind the topic in the first place ?
    I know that we can do the settings in the ejb-jar.xml where in you would give the message destination and all. But what about the lookup ? It needs to know the ip address of the topic destination from where it needs to retirieve.
    Can some body guide me if i am missing something ?
    TIA
    Meka Toka

  • Flex with JMS Topic/Queue for Asynchronous messaging

    I have been working on Flex and JMS integration using Data
    Services for Asynchronous messaging. I am able to do this
    successfuly. Now I am in need to do the same without using the Data
    Services piece.
    For doing this I have done the following ......
    I have created a JMS Webservice in the Oracle JDeveloper 10G
    along with Webservice Client.I am able to Listen to JMS Topic/Queue
    ( this has been created in the Oracle AS ) using this Webservice
    and receive the messages from this JMS Topic/Queue
    Asynchronously.....
    But If I need to use the Flex Client , I am not able to
    Communicate with this Webservice to listen to the JMS Topic/Queue.
    Did any one in this forum tried to communicate with JMS
    Topic/Queue without using Flex Data Service.If so please share your
    inputs.

    Here is my confusion (I'm using J2EESDK1.3).
    On a local server I did the following
    j2eeadmin -addJmsFactory jms/RemoteTCF topic -props url=corbaname:iiop:mars#mars
    In the app client running on the local server I had the code
    ic = new InitialContext();
    // JNDI lookup. The resource factory ref points to the
    // Remote Connection Factory I registered
    tcf = (TopicConnectionFactory)ic.lookup("java:comp/env/jms/TopicConnectionFactory");
    // The env ref points to jms/Topic of the local server
    pTopic = (Topic)ic.lookup("java:comp/env/jms/PTopic");
    So I'm assuming that I'm using a connection factory that connect to mars and a Topic on the local box.
    On remote server mars, I deployed a MDB which use
    jms/TopicConnectionFactory and jms/Topic. But I'm thinking this jms/Topic and the one I used on the local box are not the same one. Right? Then how could the app client and the MDB share messages?
    Some of my explanation I don't if it makes sense or not.
    ConnectionFactory is a way to tell what kind of connection it could generate (Queue, Topic, Durable etc) and Where the connection would go to (local or remote).'
    As for as destination, I'm not sure. How could two server share one Topic?

  • Topics, queues, etc.

    I need an opinion - how well would a system with a single MDB that handles multiple message types (e.g. xml messages, with tags to indicate the type of message) vs having multiple MDB's per topic. I guess I'm looking at a "best practice" pattern. I've been thinking of this and realized that if you have a single MDB with multiple message types, then this could mean that if there were a message type that sees a high volume vs another that sees a lower volume, the lower volume message processing of the messages would be delayed.
    From what I've read, the container is supposed to compensate for a high volume of messages through creating more instances, but this still doesn't stop the fact that the messages are processed FIFO, so having multiple topics would be a far more better way to go.
    The hope here however was to have a model where we would only have two types of messages initially processed asynchronously, while the others were processed synchronously through regular session beans, but additional message types may be turned on later to run asynchronously without having to create new MDB's for each additional topic. But I think this could just mean creating unnecessary delays for other types of messages.
    Any thoughts?
    Thanks

    Seems deployment is trying to deploy some resources on a target which does not have the prerequisite objects.
              Two guesses :
              It could be that the distributed queue is not on all servers and the deployer is trying to access it.
              Or it requires activation inbetween for the objects to be properly bound.
              The deployment forum should be the one for this imho.
              - Sathish

  • Configuring an MDB to an MQSeries Queue

    I want complete details as to how to configure an MDB to an MQSeries Queue.
              

    From the JMS FAQ at http://e-docs.bea.com/wls/docs70/faq/jms.html
              Q. How do I integrate non-WebLogic JMS providers with WLS?
              A. Refer to the white paper, "Using Foreign JMS Providers with WebLogic
              Server" (jmsproviders.pdf) on
              http://dev2dev.bea.com/resourcelibrary/whitepapers.jsp?highlight=whitepapers
              for a discussion on integrating MQ Series, IBus MessageServer, Fiorano,
              and SonicMQ.
              Or google search this newsgroup for "MQ".
              Tom
              Ranjit wrote:
              > I want complete details as to how to configure an MDB to an MQSeries Queue.
              

  • How to publish a JMS Queue?

    Hi there,
    Does anyone know how to publish a JMS queue? Thanks.
    Edited by: 886478 on Sep 20, 2011 10:17 PM

    Does anyone know how to publish a JMS queue? Thanks.Yes, I do. But rather than write a long posting describing how to use the JMS API. I'd like to invite you to read the JMS tutorial:
    http://download.oracle.com/javaee/1.3/jms/tutorial/index.html
    Look particularly at
    http://download.oracle.com/javaee/1.3/jms/tutorial/1_3_1-fcs/doc/client.html
    Nigel

  • How to list total number of message in specific Topic/queue using wlst comm

    Hi All,
    Message queue
    How to list total number of message in specific Topic/queue using wlst command

    aaaah sorry, I didn't notice you were looking for a SPECIFIC topic, bad me
    then do something like
    <pre>
    connect('weblogic','weblogic','t3://localhost:8001')
    servers = domainRuntimeService.getServerRuntimes();
    if (len(servers) > 0):
    for server in servers:
    jmsRuntime = server.getJMSRuntime();
    jmsServers = jmsRuntime.getJMSServers();
    for jmsServer in jmsServers:
    destinations = jmsServer.getDestinations();
    for destination in destinations:
    if destination.getName() == 'YOURQUEUE':
    print "Destination ", destination.getName(), " MessageCount ", destination.getMessagesCurrentCount()
    </pre>
    of course performance-wise this is a terrible script because you loop on all destinations, I am sure there is a way to lookup a specific destination, but I am too lazy to investigate....

  • MDB's and determining queues/topics

    Hi,
    I was reading recently that MDB's only allow you specify whether they consume queues or topics in their deployment descriptors, not which particular queue or topic. There were further comments to the effect that app server vendors will provide this level of granularity in a proprietary manner.
    Are there plans to allow this finer level of granularity in a standard manner or is it deemed that the existing solution is sufficient ?
    I don't particularly look forward to huge "if" clauses in the onMessage, or session beans, to deal with determining the specific queue or topic involved.
    Any comments ?
    Cheers,
    mairt

    It is true that the actual name of the que/topic is not specified in the ejb-jar.xml.
    In case of weblogic it is specified in weblogic-ejb-jar.xml in( as you said a proprietary fashion)
    by this tag <destination-jndi-name>titan-ReservationQueue</destination-jndi-name>
    This helps you avoid those huge if blocks you have anticipated.
    Well it is something we have to live with as of now.

  • Error connecting WLS 10.3.1 JMS & MDBs with Oracle Advanced Queuing

    I followed the guide at http://blogs.oracle.com/imc/2010/12/how_to_use_oracle_aq_with_message-driven_beans_in_weblogic.html. Since the AQ queues were already set up by SAs and had been working with stateless session beans, I assume they're OK for use with MDBs. Names had to be changed in the WLS foreign server definition, destinations & connection factories to match.
    My MDB is:
    package xxxx;
    import javax.ejb.MessageDriven;
    import javax.jms.JMSException;
    import javax.jms.Message;
    import javax.jms.MessageListener;
    import javax.jms.TextMessage;
    @MessageDriven(name = "TestQueueListenerEJB")
    public class TestQueueListener implements MessageListener
    public void onMessage(Message message)
    if ( message instanceof TextMessage )
    try
    System.out.println("AQMDBTest: text message " + ((TextMessage)message).getText() + " processed");
    catch (JMSException e)
    e.printStackTrace();
    else
    System.out.println("AQMDBTest: generic message " + message.toString() +
    " of type " + message.getClass().getName() + " processed");
    And the relevant portion of the weblogic-ejb-jar.xml is:
    <weblogic-enterprise-bean>
    <ejb-name>TestQueueListenerEJB</ejb-name>
    <message-driven-descriptor>
    <pool>
    <max-beans-in-free-pool>1</max-beans-in-free-pool>
    <initial-beans-in-free-pool>1</initial-beans-in-free-pool>
    </pool>
    <destination-jndi-name>TestQueue</destination-jndi-name>
    <connection-factory-jndi-name>TestQueueConnectionFactory</connection-factory-jndi-name>
    </message-driven-descriptor>
    </weblogic-enterprise-bean>
    So when I deploy this to my test domain I get an error:
    <Feb 23, 2011 3:11:28 PM CST> <Warning> <EJB> <BEA-010061> <The Message-Driven EJB: TestQueueListenerEJB is unable to connect to the
    JMS destination: TestQueue. The Error was:
    Can not get destination information. The destination JNDI name is TestQueue, the provider URL is null>
    The test connection of the datasource is successful.
    What else could I have wrong? This is my first post to this topic. Please let me know what additional information I need to provide about this. Or if I've provided too much.
    Thanks very much,
    Jim Greetham

    OK. So I got my DBAs to create a new user with the necessary privs. Created a new queue, table, etc. I have been able to receive messages from it. So I have some looking to do in my production database queue definitions.
    Jim

  • EJB 3.0 MDB configuration for Topic w/ Group only read access

    We currently have a Topic on a weblogic server (10.3) in which the security access has been turned on to only allow certain users to read from that topic.
    The issue we are having is finding the necessary documentation to how to set which user that the MDBs will use when running on the app server.
    I've tried both of these properties, but haven't had any luck yet:
    <run-as-principal-name></run-as-principal-name>
    <create-as-principal-name></create-as-principal-name>
    Any ideas/documentation on how to configure it so the MDB can also listen to the topic. The MDB won't always be on the same server as the JMS as well.
    Thanks

    This page helps -- not sure if there are any other thoughts/comments/newer ways of doing it.
    http://stackoverflow.com/questions/4887427/weblogic-message-driven-bean-reading-from-a-secured-queue-runas-does-not-work
    Thanks.

  • MDBs and local topics

    Hi all,
              I have a WLS JMS queue being fed by a bridge that pulls messages from MQ. That queue sorts the messages into 4 outgoing topics. One of the consumers of one of those topics is a local MDB. External consumers create durable subscriptions so they don't miss messages. Should my internal consumer (part of the same EJB jar that sorts the messages in the first place) also create a durable subscription? Is there any danger of missing messages?
              thanks

    Hi,
              The internal consumer may miss messages. If the server crashes before your onMessage() completes processing any message backlog, the messages will not be redelivered.
              If the internal consumer onMessage is sufficiently fast, and if I understand your app well enough, it seems that there may be a way to avoid the need for a local consumer MDB in the first place: the "sort" code itself could directly invoke a local stateless session bean that does the same thing as the MDB...
              Tom

  • MDB Listening to remote queue

              Hi,
              Could any of you please let me know what needs to be done to configure my MDB
              to listen to a remote queue in a different domain (also using wls 7.0).
              I tried adding the <provider-url> element in the weblogic-ejb-jar.xml but looks
              like that didnt work.
              Thanks,
              -Sri
              

    Posting the actual error helps. This error usually occurs due
              to a naming conflict. Make sure that:
              All local and remote:
              WL servers are named differently
              WL JMS servers are named differently
              WL JMS stores are named differently
              Tom, BEA
              P.S. For future reference, a google search of
              this newsgroup often quickly leads to answers. In this
              case search for "Connection not found" or "invocableFind".
              Sri wrote:
              > Tom, I did. But I still get this error...
              >
              > [exec] <Jun 10, 2003 9:27:57 AM EDT> <Error> <EJB> <010020> <EJB-20 - Messa
              > geDriven - Couldn't start the JMS connection: weblogic.jms.common.JMSException:
              > Connection not found
              > [exec] weblogic.jms.common.JMSException: Connection not found
              > [exec] at weblogic.jms.dispatcher.InvocableManager.invocableFind(Invoca
              > bleManager.java:134)
              > [exec] at weblogic.jms.dispatcher.Request.wrappedFiniteStateMachine(Req
              > uest.java:592)
              > [exec] at weblogic.jms.dispatcher.DispatcherImpl.dispatchSync(Dispatche
              > rImpl.java:275)
              > [exec] at weblogic.jms.client.JMSConnection.start(JMSConnection.java:54
              > 7)
              > [exec] at weblogic.ejb20.internal.JMSConnectionPoller.startJMSConnectio
              > n(JMSConnectionPoller.java:1228)
              > [exec] at weblogic.ejb20.deployer.MessageDrivenBeanPoolInfoImpl.startCo
              > nnection(MessageDrivenBeanPoolInfoImpl.java:150)
              > [exec] at weblogic.ejb20.deployer.MessageDrivenBeanPoolInfoImpl.start(M
              > essageDrivenBeanPoolInfoImpl.java:223)
              > [exec] at weblogic.ejb20.deployer.EJBDeployer.deployMessageDrivenBeans(
              > EJBDeployer.java:1560)
              > [exec] at weblogic.ejb20.deployer.EJBDeployer.start(EJBDeployer.java:14
              > 06)
              > [exec] at weblogic.ejb20.deployer.EJBModule.start(EJBModule.java:391)
              > [exec] at weblogic.j2ee.J2EEApplicationContainer.start(J2EEApplicationC
              > ontainer.java:1039)
              > [exec] at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicati
              > onContainer.java:1025)
              > [exec] at weblogic.management.deploy.slave.SlaveDeployer.setActivationS
              > tateForAllApplications(SlaveDeployer.java:617)
              > [exec] at weblogic.management.deploy.slave.SlaveDeployer.resume(SlaveDe
              > ployer.java:376)
              > [exec] at weblogic.management.deploy.DeploymentManagerServerLifeCycleIm
              > pl.resume(DeploymentManagerServerLifeCycleImpl.java:235)
              > [exec] at weblogic.t3.srvr.ServerLifeCycleList.resume(ServerLifeCycleLi
              > st.java:65)
              > [exec] at weblogic.t3.srvr.T3Srvr.resume(T3Srvr.java:832)
              > [exec] at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:300)
              > [exec] at weblogic.Server.main(Server.java:32)
              > [exec] >
              >
              > Tom Barnes <[email protected]> wrote:
              >
              >>Check your server logs for Warning and/or error messages.
              >>
              >>Make sure that you specified a correct:
              >>
              >>provider-url
              >>
              >>destination-jndi-name
              >>
              >>connection-factory-jndi-name (needed if you disabled the default
              >>connection factories in the remote domain)
              >>
              >>Sri wrote:
              >>
              >>>Hi,
              >>>
              >>>Could any of you please let me know what needs to be done to configure
              >>
              >>my MDB
              >>
              >>>to listen to a remote queue in a different domain (also using wls 7.0).
              >>
              >>>I tried adding the <provider-url> element in the weblogic-ejb-jar.xml
              >>
              >>but looks
              >>
              >>>like that didnt work.
              >>>
              >>>Thanks,
              >>>-Sri
              >>
              >
              

  • MDB on distributed topic issue (server restart)

    Setup:
              - On WebLogic 8.1 SP3, One cluster with 2 managed servers, S1 and S2.
              - JMS servers are configured for both S1 and S2.
              - ConnectionFactory(load balancing=true, server affinity=false, XA Transaction=true) is deployed to the cluster
              - Distributed topic, DT1, deployed to the cluster with physical memeber on each JMS server, T1 on S1, T2 on S2
              - MDB for DT1 is deployed in both S1 and S2
              - Sending message to DT1 thru a session bean with container managed transaction.
              Test:
              1. Start both server, and send 10 messages to DT1, evenrything is fine, both servers received 10 messsage each
              2. Shutdown S2
              3. Send another 10 messages to DT1, S1 received 10 messages thru MDB deployed on it, and noticed that there are 10 messages pending for T1 (by using console destination monitoring function)
              4. Restart S2
              5. When S2 is fully restarted, noticed that the 10 pending messages are gone for T1, but S1 printout 10 Alert: Tx heuristic result
              6. then, if send another 10 messages thru session bean in S1, both servers receives 10 messages each; if send another 10 messages thru session bean in S2, only S2 will receive them all, S1 receives nothing and noticed that 10 messages pending for T2
              Someone posted a similar issue before, but no clear answer on exactly what happened and how to fix it.
              Thanks,
              JD

    The errors are:
              <17-Feb-2005 4:40:45 o'clock PM EST> <Error> <JTA> <BEA-110412> <Xid=BEA1-054635FA5A4B74B8B574(14775730),Status=Committed,HeuristicErrorCode=XA_HEURHAZ,numRepliesOwedMe=0,numRepliesOwedOthers=0,seconds since begin=0,seconds left=300,XAServerResourceInfo[weblogic.jdbc.wrapper.JTSXAResourceImpl]=(ServerResourceInfo[weblogic.jdbc.wrapper.JTSXAResourceImpl]=(state=committed,assigned=server2),xar=weblogic.jdbc.wrapper.JTSXAResourceImpl@e8b13,re-Registered = false),SCInfo[NakinaDomain+server2]=(state=committed)) completed heuristically: (weblogic.jdbc.wrapper.JTSXAResourceImpl, HeuristicHazard, (javax.transaction.xa.XAException: No connection associated with xid = BEA1-054635FA5A4B74B8B574-7765626C6F6769632E6A6462632
              E777261707065722E4A545358415265736F75726365496D706C)) >

  • Weblogic 7.0.0.1 - Publish To Topic No Consumer Server dies

    We have been working on a problem using Weblogic Tuxedo Connection
              whereby we called an EJB which published to a topic at around 200mps.
              Using Solaris 2.8
              Tuxedo 7.1
              We got a case number 347073.
              Zach/Tom - Since we were doing performance testing we didnt initially
              have
              any consumers on the topic since it is my understanding that JMS topics
              will discard the message if there are no consumers. However after
              running
              about 20 minutes we had all sorts of problems you can refer to that case
              Then we did the EJB without any topic publishing and it ran for 16
              hours.
              Then I added back using the publish in the EJB and added one consumer.
              We are running for 3 hours and all looks well.
              There appears to be an issue with publishing a large volume of messages
              to
              a JMS topic. NOTE: ttl etc were all defaults in the example server
              which comes
              with weblogic 7.
              Any Ideas??
              I will be posting this as well to WTC newsgroup as we have the case open
              with
              the folks in New Jersey
              

    We have been working on a problem using Weblogic Tuxedo Connection
              whereby we called an EJB which published to a topic at around 200mps.
              Using Solaris 2.8
              Tuxedo 7.1
              We got a case number 347073.
              Zach/Tom - Since we were doing performance testing we didnt initially
              have
              any consumers on the topic since it is my understanding that JMS topics
              will discard the message if there are no consumers. However after
              running
              about 20 minutes we had all sorts of problems you can refer to that case
              Then we did the EJB without any topic publishing and it ran for 16
              hours.
              Then I added back using the publish in the EJB and added one consumer.
              We are running for 3 hours and all looks well.
              There appears to be an issue with publishing a large volume of messages
              to
              a JMS topic. NOTE: ttl etc were all defaults in the example server
              which comes
              with weblogic 7.
              Any Ideas??
              I will be posting this as well to WTC newsgroup as we have the case open
              with
              the folks in New Jersey
              

Maybe you are looking for

  • New Forum FAQ

    This is a work in progress and will be re-formatted soon into individual Question/Answers in an FAQ subforum. Can I over write the forums style sheets to change the layout? Yes, Please see this discussion of scripts that can help you change your view

  • File_id and relative_fno in dba_data_files

    Hi, I don't understand the difference between the columns file_id and relative_fno in dba_data_files. Does someone have in his database a row in dba_data_files where the values of file_id and relative_fno are different ? Thanks. Edited by: user639304

  • KeyListener in an Applet

    i am trying to find the functions that allow me to use key events to move and object around the screen. im geussing you would need the KeyEvent.KEY_PRESSED KeyEvent.KEY_RELEASED KeyEvent.KEY_TYPED commands but im unsure of how to use them to make the

  • IMac, no internal speaker sound on iTunes Only? Tried many fixes...

    QBBettyBoop Have iMac with most recent OS and all updates are installed. Internal speakers work on everything except iTunes? Have Apple TV, and Bose Bluetooth Speaker...plus a few other Bluetooth items(all turned off and still no connection)? Tried e

  • Weekly Aggregation based on everyday date

    Hi All, i have a table with 3 columns. Id , MeasureDate,Measure. Here   Id +MeasureDate as primary key.  In this table i want add a column Avg.  if i am running today 2/12/2014,2/5/2014,01/29/2014 and so on avarage value will be replaced in the Avg c