Does anybody know a working example (with source code and descriptors) of a session bean calling a message driven bean running in borland enterprise server 5.2? I didn't manage to make that fly...
ThanX in advance,
I'd be interested in any sample code that can call an MDB.
Message Driven Beans are asynchronous and driven by queues or topics. They do not have client interfaces and so cannot be called.
An MDB is triggered only by receipt of a message (either via a topic or a queue).
And of course any java code (either a standalone Java application/Web App/EJBs) can publish a message to a queue/topic. This would trigger the onMessage() of an MDB subscribed to this queue/topic.
ThanX for your replies, Aaron and Krishnan!
But in principle I know, how MDBs can be invoked. So I think I have to go more into the details of my problem:
What I tried to do is to take the (working) MDB example comming with the BES 5.2 and adding a stateless session bean that should call the MDB insted the client (I used exactly the same code). Furthermore I modified the client to call the one and only parameterless void function of the session bean.
The problem I didn't solve is, that the QueueSender.send() methode raises an Exception:
java.lang.UnsupportedOperationException: Most probably XA and non-XA connection factories have been mixed in the same transaction
I tried lots of things (using the XA and non-XA factory queues, changing the session beans transaction setting to "bean managed", using JNDI names in the form "serial://jms/tcf" (like the sample does) and "serial://resources/tcf" (like the developers guide describes)...), but nothing worked.
Be aware, that the MDBs can be called everytime by a client and the connection between client and session bean is good too. So my guess is, that there is something wrong in my descriptor files, but, sorry, I have no idea what...
Do you have any ideas?
The original Borland sample writes first to a queue and then to a topic. What I tried now was to remove the queue stuff and see whats happening when the session bean only attempts to usa a topic. The result was: nada. But the server side exception is a completely different one:
javax.jms.IllegalStateException: The session is closed.
Strange, isn't it?
BTW: Today I did the same with JBoss and it worked the first time I tried. But there are no mysterious vendor specific descriptor files...