Author |
Message
|
viki |
Posted: Sat Mar 11, 2006 7:02 am Post subject: Using MDB on a listener ports? |
|
|
Acolyte
Joined: 07 Feb 2006 Posts: 50
|
Hi,
Till now, I was making connection with WebSphere MQ v5.3 using JMS and was senidng/recieveing messages using javax.jms.QueueReceiver and javax.jms.QueueSender for send/recieve from as a standalone java application.
Now, I want to use Message Driven Bean as a listener on ports. I haven't use MDB before, but I've read about it, i.e. used for asynchronous messaging.
I guess there is a lot of work invloved in configuring Application Server in order to use MDB.
It'll be great if anybody could guide me where to start? I'm using WebSphere Application Server V5.1 and RAD V6 as an IDE on Win XP - SP2.
Bye,
Viki. |
|
Back to top |
|
 |
fjb_saper |
Posted: Sat Mar 11, 2006 8:49 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Read up on WAS manual.
The config will be done in the WAS management console.
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
viki |
Posted: Sat Mar 11, 2006 9:00 am Post subject: |
|
|
Acolyte
Joined: 07 Feb 2006 Posts: 50
|
Hi,
I've read and doing the configuration. Don't know whether it will work or not? But the problem I'm facing is configuring listner ports in WAS Properties in Rational Application Developer V6.
Well, I'm trying... And will be back if stuck!
Bye,
Viki. |
|
Back to top |
|
 |
viki |
Posted: Sat Mar 11, 2006 12:17 pm Post subject: |
|
|
Acolyte
Joined: 07 Feb 2006 Posts: 50
|
Hi,
Ok, I have configured conenection via WAS Management Console. Here it is:
Resources---> WebSphere MQ JMS Provider---Additional Properties---> WebSphere MQ Queue Connection Factories for Connection Factory AND
Resources---> WebSphere MQ JMS Provider---Additional Properties---> WebSphere MQ Queue Destinations for Queue Destinations.
Connection code:
Code: |
InitialContext context = new InitialContext();
QueueConnectionFactory factory = (QueueConnectionFactory) context.lookup("jms/MyMQ");
QueueConnection connection=factory.createQueueConnection();
Destination dest = (Destination) context.lookup("jms/MyMQQueue");
|
Now it's time to configure MDB for listeners. But I do not have EJB Deployment Desriptor in my IDE where I have created project (in RAAD V6).
Do i have to configure MDB in WAS Managemnet Console? In RAD V6, there is a properties for WebSphere Application Server V5.1, where it ask for EJB Listerner port name, Connection Factory JNDI Name and Destination JNDI Name. I guess, I have to configure it too in order to use MDB on listener port?
Looking forward for the reply.
Thanks,
Bye,
Viki |
|
Back to top |
|
 |
fjb_saper |
Posted: Sat Mar 11, 2006 2:34 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Yup.
Don't know about being able to do the config in RAD. With WASADIE you did it all in the WAS management console.
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
viki |
Posted: Sun Mar 12, 2006 10:35 am Post subject: |
|
|
Acolyte
Joined: 07 Feb 2006 Posts: 50
|
Hi,
Just thinking whether I should use Message Driven Bean for asynchronous message recieve? Because, it is stated in Using Java Chapter 10:
Quote: |
Asynchronous delivery
An alternative to making calls to QueueReceiver.receive() is to register a method that is called automatically when a suitable message is available. The following fragment illustrates the mechanism:
import javax.jms.*;
public class MyClass implements MessageListener
{
// The method that will be called by JMS when a message
// is available.
public void onMessage(Message message)
{
System.out.println("message is "+message);
// application specific processing here
.
.
.
}
}
.
.
.
// In Main program (possibly of some other class)
MyClass listener = new MyClass();
queueReceiver.setMessageListener(listener);
// main program can now continue with other application specific
// behavior.
|
If this is satisfying the asynchronous message recieving, then what is the use of MDB?
Do web containers like in WebSphere Application Server V5.1 supports only asynchronous delivery via MDB?
Bye,
Viki. |
|
Back to top |
|
 |
fjb_saper |
Posted: Sun Mar 12, 2006 6:59 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
No the MessageListener allow you to get an MDB like functionality outside of the web container.
If you noticed the MDB does implement the MessageListener interface. The MDB is the containers implementation of the MessageListener and takes advantage of all the container facilities: connection pooling, transaction management etc...
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
viki |
Posted: Mon Mar 13, 2006 11:01 pm Post subject: |
|
|
Acolyte
Joined: 07 Feb 2006 Posts: 50
|
Hi,
Well, implemented MDB's
Bye,
Viki. |
|
Back to top |
|
 |
|