Message redelivery with non-transactional message bean JMS standard or weblogic standard?

It is my understanding (or maybe my assumption) that a message is
          re-queued only if the transaction attribute of a container-managed
          message bean is set to "Required" and the message is PERSISTENT. So if
          it's set to "NotSupported", and thus, message receival is not within a
          transaction, the message would be un-queued and thus never be
          redelivered, should a failure occur within the bean. I discovered that
          even if the message bean is set as "NotSupported", should a failure
          occur within the bean, the message is re-queued to be received again
          at a later time.
          I'm very confused as to whether this mechanism is a JMS standard, or a
          feature of Weblogic. Well, maybe I'm just confused about message
          delivery/re-delivery. I understand that the JMS standard requires
          guaranteed delivery of a message to a receiver. Does this mean a
          message is only considered delivered if an acknowledgement is
          received, regardless of the transaction level? In other words, is the
          JMS standard that a message is considered delivered only if
          acknowledgement is indicated through the container, regardless of the
          transaction level of the message bean itself?
          

You're right on the second part. That is, a JMS message is not considered to
          be "delivered" until it is acknowledged. There are a number of ways to make
          this happen when programming to the raw JMS API -- a look at the Javadoc for
          JMS or a good JMS book should clarify how to do this.
          With a message-driven bean, the EJB container acknowledges the message after
          you've successfully returned from the "onMessage" method. If you throw a
          RuntimeException from the "onMessage" method, or if it's an MDB with a
          transaction mode of "Required" and you call "setRollbackOnly" on the
          "MessageDrivenContext" object -- then your message will be redelivered.
          Regardless of how a message is acknowledged, if it's not acknowledged then
          it will be redelivered. This has nothing to do with whether the message is
          persistent. The difference is that if a message is persistent, then the JMS
          server is required to keep a copy on stable storage until the message is
          acknowledged so that if the JMS server itself crashes, the message will not
          be lost. For a non-persistent message, on the other hand, if the JMS server
          crashes, then the message may be lost.
          greg
          "Justin" <[email protected]> wrote in message
          news:[email protected]...
          > It is my understanding (or maybe my assumption) that a message is
          > re-queued only if the transaction attribute of a container-managed
          > message bean is set to "Required" and the message is PERSISTENT. So if
          > it's set to "NotSupported", and thus, message receival is not within a
          > transaction, the message would be un-queued and thus never be
          > redelivered, should a failure occur within the bean. I discovered that
          > even if the message bean is set as "NotSupported", should a failure
          > occur within the bean, the message is re-queued to be received again
          > at a later time.
          >
          > I'm very confused as to whether this mechanism is a JMS standard, or a
          > feature of Weblogic. Well, maybe I'm just confused about message
          > delivery/re-delivery. I understand that the JMS standard requires
          > guaranteed delivery of a message to a receiver. Does this mean a
          > message is only considered delivered if an acknowledgement is
          > received, regardless of the transaction level? In other words, is the
          > JMS standard that a message is considered delivered only if
          > acknowledgement is indicated through the container, regardless of the
          > transaction level of the message bean itself?
          

Similar Messages

  • NON-transactional session bean access entity bean

    We are currently profiling our product using Borland OptmizeIt tool, and we
    found some interesting issues. Due to our design, we have many session beans which
    are non transactional, and these session beans will access entity beans to do
    the reading operations, such as getWeight, getRate, since it's read only, there
    is no need to do transaction commit stuff which really takes time, this could
    be seen through the profile. I know weblogic support readonly entity bean, but
    it seems that it only has benefit on ejbLoad call, my test program shows that
    weblogic still creates local transaction even I specified it as transaction not
    supported, and Transaction.commit() will always be called in postInvoke(), from
    the profile, we got that for a single method call, such as getRate(), 80% time
    spent on postInvoke(), any suggestion on this? BTW, most of our entity beans are
    using Exclusive lock, that's the reason that we use non-transactional session
    bean to avoid dead lock problem.
    Thanks

    Slava,
    Thanks for the link, actually I read it before, and following is what I extracted
    it from the doc:
    <weblogic-doc>
    Do not set db-is-shared to "false" if you set the entity bean's concurrency
    strategy to the "Database" option. If you do, WebLogic Server will ignore the
    db-is-shared setting.
    </weblogic-doc>
    Thanks
    "Slava Imeshev" <[email protected]> wrote:
    Hi Jinsong,
    You may want to read this to get more detailed explanation
    on db-is-shared (cache-between-transactions for 7.0):
    http://e-docs.bea.com/wls/docs61/ejb/EJB_environment.html#1127563
    Let me know if you have any questions.
    Regards,
    Slava Imeshev
    "Jinsong HU" <[email protected]> wrote in message
    news:[email protected]...
    Thanks.
    But it's still not clear to me in db-is-shared setting, if I specifiedentity
    lock as database lock, I assumed db-is-shared is useless, because foreach
    new
    transaction, entity bean will reload data anyway. Correct me if I amwrong.
    Jinsong
    "Slava Imeshev" <[email protected]> wrote:
    Jinsong,
    See my answers inline.
    "Jinsong Hu" <[email protected]> wrote in message
    news:[email protected]...
    Hi Slava,
    Thanks for your reply, actually, I agree with you, we need to
    review
    our db
    schema and seperate business logic to avoid db lock. I can not say,guys,
    we need
    to change this and that, since it's a big application and developedsince
    EJB1.0
    spec, I think they are afraid to do such a big change.Total rewrite is the worst thing that can happen to an app. The
    better aproach would be identifying the most critical piece and
    make a surgery on it.
    Following are questions in my mind:
    (1) I think there should be many companies using weblogic serverto
    develop
    large enterprise applications, I am just wondering what's the maintransaction/lock
    mechanism that is used? Transional session / database lock,
    db-is-shared
    entity
    I can't say for the whole community, as for my experience the standard
    usage patthern is session fasades calling Entity EJBs while having
    Required TX attribute plus plain transacted JDBC calls for bulk
    reads or inserts.
    is the dominant one? It seems that if you speficy database lock,
    the
    db-is-shared
    should be true, right?Basically it's not true. One will need db-is-shared only if thereare
    changes
    to the database done from outside of the app server.
    (2) For RO bean, if I specify read-idle-timeout to 0, it shouldonly
    load
    once at the first use time, right?I assume read-timeout-seconds was meant. That's right, but if
    an application constantly reads new RO data, RO beans will be
    constantly dropped from cache and new ones will be loaded.
    You may want to looks at server console to see if there's a lot
    of passivation for RO beans.
    (3) For clustering part, have anyone use it in real enterpriseapplication?
    My concern, since database lock is the only way to choose, how aboutthe
    affect
    of ejbLoad to performance, since most transactions are short live,if high
    volume
    transactions are in processing, I am just scared to death about
    the
    ejbLoad overhead.
    ejbLoad is a part of bean's lifecycle, how would you be scared ofit?
    If ejbLoads take too much time, it could be a good idea to profile
    used SQLs. Right index optimization can make huge difference.
    Also you may want cosider using CMP beans to let weblogic
    take care about load optimization.
    (4) If using Optimization lock, all the ejbStore need to do
    version
    check
    or timestamp check, right? How about this overhead?As for optimistic concurrency, it performs quite well as you can
    use lighter isolation levels.
    HTH,
    Slava Imeshev
    "Jinsong Hu" <[email protected]> wrote in message
    news:[email protected]...
    We are using Exclusive Lock for entity bean, because of we do
    not
    want
    to
    load
    data in each new transaction. If we use Database lock, that means
    we
    dedicate
    data access calls to database, if database deadlock happens,
    it's
    hard
    to
    detect,
    while using Exclusive lock, we could detect this dead lock in
    container
    level.
    The problem is, using Exclusive concurrency mode you serialize
    access to data represented by the bean. This aproach has negative
    effect on ablity of application to process concurrent requests.As
    a
    result the app may have performance problems under load.
    Actually, at the beginnning, we did use database lock and usingtransactional
    The fact that you had database deadlocking issues tells that
    application logic / database schema may need some review.
    Normally to avoid deadlocking it's good to group database
    operations mixing in updattes and inserts into one place so
    that db locking sequence is not spreaded in time. Moving to
    forced serialized data access just hides design/implementation
    problems.
    session bean, but the database dead lock and frequent ejbLoad
    really
    kill
    us,
    so we decided to move to use Exclusive lock and to avoid dead
    lock,
    we
    change
    some session bean to non-transactional.Making session beans non-transactions makes container
    creating short-living transactions for each call to entity bean
    methods. It's a costly process and it puts additional load to
    both container and database.
    We could use ReadOnly lock for some entity beans, but since weblogicserver will
    always create local transaction for entity bean, and we found
    transaction
    commit
    is expensive, I am arguing why do we need create container leveltransaction for
    read only bean.First, read-only beans still need to load data. Also, you may seeRO
    beans
    contanly loading data if db-is-shared set to true. Other reason
    can
    be
    that
    RO semantics is not applicable the data presented by RO bean (forinstance,
    you have a reporting engine that constantly produces "RO" data,
    while
    application-consumer of that data retrieves only new data and neverasks
    for "old" data). RO beans are good when there is a relatively stable
    data
    accessed repeatedly for read only access.
    You may want to tell us more about your app, we may be of help.
    Regards,
    Slava Imeshev
    I will post the performance data, let's see how costful
    transaction.commit
    is.
    "Cameron Purdy" <[email protected]> wrote:
    We are currently profiling our product using Borland
    OptmizeIt
    tool,
    and we
    found some interesting issues. Due to our design, we have
    many
    session
    beans which
    are non transactional, and these session beans will access
    entity
    beans
    to
    do
    the reading operations, such as getWeight, getRate, since
    it's
    read
    only,
    there
    is no need to do transaction commit stuff which really takes
    time,
    this
    could
    be seen through the profile. I know weblogic support readonly
    entity
    bean,
    but
    it seems that it only has benefit on ejbLoad call, my test
    program
    shows
    that
    weblogic still creates local transaction even I specified
    it
    as
    transaction not
    supported, and Transaction.commit() will always be called
    in
    postInvoke(),
    from
    the profile, we got that for a single method call, such as
    getRate(),
    80%
    time
    spent on postInvoke(), any suggestion on this? BTW, most of
    our
    entity
    beans are
    using Exclusive lock, that's the reason that we use
    non-transactional
    session
    bean to avoid dead lock problem.I am worried that you have made some decisions based on an improper
    understand of what WebLogic is doing.
    First, you say "non transactional", but from your description
    you
    should
    have those marked as tx REQUIRED to avoid multiple transactions
    (since
    non-transactional just means that the database operation becomesits
    own
    little transaction).
    Second, you say you are using exclusive lock, which you shouldonly
    use
    if
    you are absolutely sure that you need it, (and note that it
    does
    not
    work in
    a cluster).
    Peace,
    Cameron Purdy
    Tangosol, Inc.
    http://www.tangosol.com/coherence.jsp
    Tangosol Coherence: Clustered Replicated Cache for Weblogic
    "Jinsong Hu" <[email protected]> wrote in message
    news:[email protected]...
    >

  • Publishing message to JMS Queue on Weblogic from OSB proxy service

    Hi,
    1. I have created a JMS module: testModule and a JMS queue: testQueue in the weblogic admin console.
    2. Created a business service with the above queue as endpoint.
    3. Created a proxy service which publishes the message to the queue using the business service. I have used Publish activity to publish the message to the business service.
    When i run the proxy service with the request message, then, no error is coming but, in the admin console when i click on JMS module->testModule->testQueue->Monitoring tab, i see nothing. There are no entries in the table so, how can i check if the message is properly published to the queue or not.
    The queue is not listened by any service for consuming the messages.
    Kindly help me in figuring out this issue.
    Thanks in advance.

    If the destination was a topic, the behavior would be expected. Messages only stays on a topic and are delivered to consumers if there are consumers or durable subscribers.
    Did you check the server logs and see if there are any exceptions or warnings?
    You can also turn on jms debugging by adding the following to your server startup script.
    -Dweblogic.debug.DebugJMSFrontEnd=true
    -Dweblogic.debug.DebugJMSBackEnd=true
    The debugging messages wiill show up in the server log.

  • JMS Messages keep on growing for a Topic with non-durable consumers

    I have a JMS Server whose "Messages Current" keeps on growing after every message send to the topic. All the consumers are non-durable. The session is a non-transacted session with Auto Accknowledge parameter. My client does recieve the message, but it does not go down from the "Messages Current" in the WLS console. Also once the server is restarted, the messages go down to 0.
    I am using 9.2 SP2 on a Solaris environment.
    Any insight would be helpful

    It's possible that one or more the subscribers is stalled for some reason and so is not actually receiving and processing messages. This would cause messages to accumulate. You can examine statistics for individual consumers on the console to see if this is an issue.
    Also, there could be a durable subscription on the topic left over from some previous application you used with the topic. There are statistics for these as well.
    Yet another possibility is that the clients are receiving the messages but are failing to acknowledge/commit them. You wrote that the sessions are "auto-acknowledge" but they could accidentally be "transacted". Check to make sure that the first parameter passed to "createSession" is true (it should be false), and that the second parameter is set to auto-acknowledge.
    Finally, if you happen to be using a distributed topic, keep in mind that if one of the topic members is unavailable/crashed/down messages will accumulate on the other distributed topic members until the unavailable member is restarted (at which point they will be forwarded to the restarted member).
    Tom

  • Send message in a non-transactional context

    I've coded a simple Log4j appender to send error messages to a queue (JMSAppender provided by Log4J is not good for me because it use a publish/subscrive model and use topics instead of queues); the appender has to work in a non transactional context, so the appender has to send always the message to queue although the global transaction rollbacks; I've create queue session settings transacted parameter to false and acknowledgeMode to AUTO_ACKNOWLEDGE , but message is not delivered to queue if the global transaction, started by an EJB Stateless Session Bean, rollbacks; in my environment (IBM WebSphere and IBM MQ), queue connection factory is configured no-XA resource.
    Any suggestions?
    Below the source code.
    Thanks in advance
    context = new InitialContext();
    queueFactory = (QueueConnectionFactory) context.lookup(getQueueConnectionFactoryBindingName());
    queueConnection = queueFactory.createQueueConnection();
    queueSession = queueConnection.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);
    queue = (Queue) context.lookup(getQueueBindingName());
    queueSender = queueSession.createSender(queue);
    queueConnection.start();Rob

    I've coded a simple Log4j appender to send error messages to a queue (JMSAppender provided by Log4J is not good for me because it use a publish/subscrive model and use topics instead of queues); the appender has to work in a non transactional context, so the appender has to send always the message to queue although the global transaction rollbacks; I've create queue session settings transacted parameter to false and acknowledgeMode to AUTO_ACKNOWLEDGE , but message is not delivered to queue if the global transaction, started by an EJB Stateless Session Bean, rollbacks; in my environment (IBM WebSphere and IBM MQ), queue connection factory is configured no-XA resource.
    Any suggestions?
    Below the source code.
    Thanks in advance
    context = new InitialContext();
    queueFactory = (QueueConnectionFactory) context.lookup(getQueueConnectionFactoryBindingName());
    queueConnection = queueFactory.createQueueConnection();
    queueSession = queueConnection.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);
    queue = (Queue) context.lookup(getQueueBindingName());
    queueSender = queueSession.createSender(queue);
    queueConnection.start();Rob

  • HT202724 When I send a message in a group with non-iPhone users it appears as a mms, how do I change the settings so it's a sms?

    When I send a message in a group with non-iPhone users it appears as "New Multimedia Message." One of my friends in the group also has an iPhone and his doesn't appear this way, how do I change my settings so it appears as a normal text message and not an mms?

    iOS: Troubleshooting Messages - Apple Support
    Send a group message with your iPhone, iPad, or iPod touch - Apple Support
    Send messages with your iPhone, iPad, or iPod touch - Apple Support

  • When I send a text message to my two children with non-smart phones, the message comes throug blank. When I send a message to them one at a time it will go through but not multiple addresses. Can this problem be fixed?

    When I send a text message on my iPhone 4s to my two children with non-smart phones, the message comes through blank. If I send it to each one individually, it will go through ok. Is this a problem with my phone or it is something I am doing wrong.

    Check your phone to make sure MMS is turned on. If it is, check with your cell provider and make sure your phone is provisioned correctly.

  • Text Messaging in Japanese (or other language with non-Roman script)

    Is it possible to send/receive text messages written in non-Roman characters with Verizon? 
    More specifically, I'm using a Droid 2 with Verizon, and I'm trying to text a friend in Japanese.  She has an iPhone (AT&T), and is physically in the U.S. (so I'm not asking about international text messaging).  I've already installed apps on my Droid (e.g. OpenWNN, or Simeji) to input Japanese, which work fine in and of themselves, and the Droid of course displays Japanese text or other languages just fine on the Browser or in E-mails.
    However, I'm having lots of trouble with Text Messaging.  When I send a message containing Japanese text (typed in perfectly fine with OpenWNN or whatever), she either never gets the message, or the text comes out unreadable (as ???????).  Messages with a mix of Roman and non-Roman characters typically show the Roman characters ok, but the non-Roman ones (i.e. Japanese) are garbled.  If she sends me a message containing any non-Roman characters, I generally don't get the message at all (i.e. not even garbled-- just no message at all).   This deficiency seems to be specific to Text Messaging, as far as I can tell.  I can send and receive e-mails containing Japanese just fine, read foreign language web pages, and type in Japanese into search boxes on those web pages and so on with the Droid.  However, sending an e-mail message to (myphone#)@vtext.com, predictably, results in any Japanese text being garbled, though Roman characters come through just fine.
    Is this perhaps something specific to Verizon's network?  Or is text messaging in non-Roman scripts just inherently impossible?  My friend says she knows others who can successfully text in non-Roman scripts (e.g. Korean Hangul, Japanese Kana or Kanji), and claims some of these folks are Verizon customers too.  A search on droidforums.com yielded someone who supposedly could text in Korean within Verizon.  So, I'm hoping this is possible, and I'm just missing something. However, this is perhaps all secondhand information and rumor.
    (Incidentally, I know for certain that messaging with non-Roman scripts is possible in general.  During my last vacation in Japan, I rented a phone there, and could send messages in English or Japanese scripts.  However, I believe the phones there actually have their own e-mail addresses, and so the service there is more like regular e-mail-- my understanding is that text messaging as we know it in the U.S. is a distinct technology, though I could well be wrong.)
    So, to restate my question: is it possible to text message with non-Roman scripts with Verizon?  Has anyone out there done this successfully-- if so what did you do, or what app did you use?  Or is it in fact impossible? (e.g. Maybe text messaging here only uses 7 or 8 bits, instead of 14 or 16 needed to encode all the various Asian, European, and other scripts?)
    Thanks for any help available.

    I'm trying to figure this out as well, but my understanding on the matter is that Verizon's CDMA network uses unicode which will display, roman characters, loa, thai, and serveral other languages, but not hirigana, kanji, katakana, or simplified or traditional chinese.  The Romaji should work however.  It would be nice to hear some input from a Verizon rep on the subject, because like you my info is all second hand.
    If my understanding is correct, the simple answer is no, it's not possible.  

  • Problem with Text Messaging on new iphone with non iphone users

    Ever since I set up imessage forwarding to be able to send/receive text messages on both my mac book pro and iphone people with non iphones are not getting my text messages from either device. 
    In my settings - messages - text message forwarding it only has one device enabled which is my mac book pro.  There is an option to enable my iphone. Do I need to do that? I did try and it's asking me for a code.  If i do need to do this where on my phone do i get this code? Thank you.

    Have you tried reporting the problem to AT&T?

  • Am I correct in assuming that Messages cannot communicate with non-Apple devices?

    Am I correct in assuming that Messages cannot communicate with non-Apple devices from laptops and or desktop apple devices?  From iPhone there seems to be no barriers to this using Messages.

    I wonder if Mt. Lion will include texting to "other" devices.  For there to be true continuity across platforms this needs to happen.
    Right now I am having an interesting thing happen - even messaging with another Mac User I am getting the red ! on all my messages sent from my mac.  Yet he is gitting them.  I am assuming this is some kind of beta thing.

  • Can iMessage be used with non iOS 5 users, ie non-apple users. My new i-pad 2 error message says these contacts are not recognized by imessage when I try to text some of these contacts.

    Can iMessage be used with non iOS 5 users, ie non-apple users?
    My new i-pad 2 error message says these contacts are not recognized by imessage when I try to send them a text.

    So that means that I can send text messages through my i-phone to reach non iOS 5 users, but not through my i-pad 2.

  • Any way to message with non apple

    Have tried to text with non apple user.  Is there any way this can be done.  My iPad is wifi only.

    Only with an app.   There are several text free apps in the store.

  • Exception while putting messages on JMS Qeue through ODI

    Hi All,
    CASE:
    We have two seperate Unix Machines.
    Installations on Machine1:
    1.) Weblogic 10.3.5
    2.) OID (Oracle Internet Directory) installed on weblogic.
    3.) JMS Server installed on weblogic.
    4.) JMS Queues on weblogic.
    Installations on Machine 2:
    1.) Weblogic 10.3.5
    2.) Oracle Data Integrator Server on weblogic (NOTE: ODI Version is 11.1.1.5)
    3.) ODI Java EE Agent deployed on ODI Server.
    JMS Queue Data Server is configured in ODI (Machine 2), which sends and receives Messages on JMS Queues (Machine 1).
    While connecting JMS Queue on Machine 1 through ODI Java Agent (OracleDIAgent), it connects for the first time but fails while making successive connections
    to Queue. And also then all other ODI data servers connections (i.e. Java EE Agent, Oracle Data Servers, JMS Queue) through Java EE Agent fails with the following exception:
    ODI-3034:Test connection failed due to ODI-1274: Agent Exception Caused by: Create DwgConnectConnection to master repository failed; nested exception is java.sql.SQLException: Pool connect failed : java.lang.SecurityException: [Security:090398]Invalid Subject: principals=[weblogic, Administrators].
    Kindly help me out in resolving the issue.
    Thanks

    Hi,
    you may be interested in a solution I tracked down at http://support.bea.com/application?namespace=askbea&origin=ask_bea.jsp&event=button.search_ask_bea&askbea_display=relevancy&askbea_max_number_returned=50&question=weblogic.jms.common.JMSException%3A+Connection+not+found&all_bea_products=all_bea_products&ES=ES#
    Basically : you need to have your Weblogic servers, JMS servers and JMS stores
    on each domain named uniquely !!!
    "Joe Mooney" <[email protected]> wrote:
    >
    Any news on this one ?
    "B Liu" <[email protected]> wrote:
    Can u tell me how you supplied the required security credentials?
    Thanks,
    -Ben
    "Andy" <[email protected]> wrote:
    Hi.
    I have a situation where I am sending an JMS message to external queue
    on Weblogic
    Server which is not part of cluster. This happens in a session bean,which
    is wrapped
    in a container transaction. I have supplied the required security credentials
    like user, password etc.
    I get an error while tryign to send the message through bean. The stack
    trace
    is :
    weblogic.jms.common.JMSException: Connection not found
    at weblogic.jms.dispatcher.InvocableManager.invocableFind(InvocableManager.java:136)
    at weblogic.jms.dispatcher.Request.wrappedFiniteStateMachine(Request.java:596)
    at weblogic.jms.dispatcher.DispatcherImpl.dispatchSync(DispatcherImpl.java:153)
    at weblogic.jms.client.JMSConnection.createSessionInternal(JMSConnection.java:400)
    at weblogic.jms.client.JMSConnection.createQueueSession(JMSConnection.java:347)
    also one thing interesting is that if I call the same server and queue
    outside
    of the session bean,it works fine.
    Any ideas what might be causing the issue?
    Thanks
    Andy

  • 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

  • JMS event generator only gets non-transactional queue msg

    Hi,
    I have created a JMS event generator to listen to a particular queue. It seems to work perfectly fine if, when posting a message to the queue that the JMS EG is listening to, the queue created is a non-transactional queue, i.e. queueConnection.createQueueSession(false, ...).
    However if I created a transactional queue to post message to the JMS EG, i.e. queueConnection.createQueueSession(true, ...), then the JMS EG can't seem to see the message. I checked in the WLI Admin console, JMS EG section, and there are no messages read by the particular JMS EG after I have posted the msg to the queue.
    My question is: is there a known limitation on the JMS EG that it can only read from a non-transactional JMS queue, or is this a bug? (I am using weblogic 8.1 sp2).
    Thanks
    Regards,
    xlfhk

    Hi,
    sorry, just discovered it's my mistake. Instead of using the transaction created when calling queueConnection.createQueueSession(true, ...), and committing that, I created a JTA transaction artificially wrapping the entire chunk of code.
    As a result, I ended up with a pair of transactions that are nested (I think ...), and the external transaction's commit was called when the nested JMS transaction hasn't been committed yet. As a result, no commit ever took place (I think again ...).
    I have now tried calling queueSession.commit() after sending the message. It seems to work fine. Thanks for the help.
    Regards,
    xlfhk.

Maybe you are looking for