-
1. Re: Asynchronous send within Session EJB to queue with MDB l
cbrown Aug 31, 2002 2:32 PM (in response to cbrown)I forgot to mention that we have also tried using createQuoteSession(true, 0), as suggested in the Sun JMS Tutorial. Subsequent calls to send messages return quickly with no Exceptions or Errors thrown, however the message sent never arrives in the queue and therefore is never processed by the MDB.
-
2. Re: Asynchronous send within Session EJB to queue with MDB l
schaefera Sep 1, 2002 8:42 PM (in response to cbrown)Hi
You second part does not work because I guess you are using a regular Connection Factory. But these are not added to the EJB transaction context so the transaction rollsback after a while. So you can either call commit() on the session or you have to use "java:/JmsXA" connection factory.
On the other hand please let me know which version you are using and which OS.
Have fun - Andy -
3. Re: Asynchronous send within Session EJB to queue with MDB l
cbrown Sep 2, 2002 2:01 AM (in response to cbrown)Thanks for the response. We are using JBoss 3.0.0 on both Windows 2000 with Sun JRE 1.3.1 and Redhat Linux with IBM JRE 1.3.0. We plan on moving to JBoss 3.0.1 in the near future.
When you refer to the second part, I am assuming you mean using createQueueSession(true, 0), which as I understand it is the method we should be using to asynchronously send to a queue. It makes sense we would need to use the XAConnectionFactory. However, wouldn't it make sense for some sort of Error or Exception to be thrown when trying to make a connection that is not allowed from within an EJB? Our code happily chugs along although the message never arrives at the queue.
I will follow up with the results of using the XAConnectionFactory. -
4. Re: Asynchronous send within Session EJB to queue with MDB l
cbrown Sep 2, 2002 2:57 AM (in response to cbrown)Thanks for the response. We are using JBoss 3.0.0 on both Windows 2000 with Sun JRE 1.3.1 and Redhat Linux with IBM JRE 1.3.0. We plan on moving to JBoss 3.0.1 or later in the near future.
When you refer to the second part, I am assuming you mean using createQueueSession(true, 0), which as I understand it is the method we should be using to asynchronously send to a queue. It makes sense we would need to use the XAConnectionFactory. However, wouldn't it make sense for some sort of Error or Exception to be thrown when trying to make a connection that is not allowed from within an EJB? Our code happily chugs along although the message never arrives at the queue.
I will follow up with the results of using the XAConnectionFactory. -
5. Re: Asynchronous send within Session EJB to queue with MDB l
cyates Sep 2, 2002 5:41 AM (in response to cbrown)I have done this using the following:
Have an interface IOperation with a method called "doOperation()".
Have a MDB which listens to a queue and assumes that he ObjectMessage is IOperation. This MDB will then call IOperation.
In the session bean, create an instance of IOperation to do what you want and place it on the message queue. The session bean will *only* wait for the bean to be placed on the queue, not the execution of the bean.
I then have a seperate class called OperationResult which the MDB passes into IOperation.doOperation which is then placed on the replyQueue but that is optional.
It really does work and is a very simple way of introducing asynchronous behaviour. I use it for logging where the user visits.
Hope this helps -
6. Re: Asynchronous send within Session EJB to queue with MDB l
schaefera Sep 3, 2002 12:48 AM (in response to cbrown)Hi
The ussage of a "client" ConnectionFactory is allowed within an application server like the direct usage of a JDBC Connection without using a DataSource (even this is not recommended). So no need to throw an exception.
In J2EE it is important that people understand the underlying framework but I agree the EJB 2.0 spec. is not very clear on this either.
I will see that this is mentioned in the Quick Start Guide.
Have fun - Andy -
7. Re: Asynchronous send within Session EJB to queue with MDB l
cbrown Sep 4, 2002 2:30 AM (in response to cbrown)Thanks again for the responses.
Indeed, using the "java:/JmsXA" ConnectionFactory solved the problem.
Some mention of the JmsXA ConnectionFactory in the Quick Start Guide would have been a help to me, and I'm sure would help others in the future. I also have the JBoss Administration and Development Guide, which does not specifically address this topic. I think an example using the JmsXA ConnectionFactory in the JMS chapter would be very useful. I would be happy to contribute this example.