ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum IndexIBM MQ Java / JMSMQ Listener & Business Logic Implementation

Post new topicReply to topic
MQ Listener & Business Logic Implementation View previous topic :: View next topic
Author Message
shayad
PostPosted: Mon Jan 21, 2008 12:05 am Post subject: MQ Listener & Business Logic Implementation Reply with quote

Newbie

Joined: 20 Jan 2008
Posts: 5

Hi,

I have a very simple/basic question.

How can a MQ Listener be configured to invoke a Java Class (the very popular message driven pojo).

As per my understanding, the MQ Listener (single process with the capability to run multiple threads) works with a Queue Manager and is responsible for fetching messages from the request queue. However, most messages need to transformed to domain or business objects and require some business rules to be run. How can I configure MQ Listener to invoke a message driven pojo? I havent been able to find an answer or example.

Uisng MQ as a JMS Provider is an option. However, I wanted to know if there is a non-JMS option as well. T

Back to top
View user's profile Send private message
jefflowrey
PostPosted: Mon Jan 21, 2008 1:45 am Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

The "MQ listener" can't do this, even in JMS.

Any program that sits in a Get-with-Wait loop, however, is an "MQ listener", and can do whatever you code it to do.

The MDB Listeners in the JMS standard are an example of this.

You need to be very careful about working with messaging in general, and MQ in particular, when talking about sending "domain or business objects". Because you really need to have your "domain or business objects" be able to marshalled and unmarshalled into data in the message, rather than objects.

Java objects are very unportable. Flattened representations of the data in the object, perhaps as XML, on the other hand, are very portable.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
shayad
PostPosted: Mon Jan 21, 2008 9:11 am Post subject: MQ Listener & Business Logic Implementation Reply with quote

Newbie

Joined: 20 Jan 2008
Posts: 5

Hi,

Thanks for the reply.

I didnt word my question properly. The actual messages on the queue will be xml(s) that will be unmarshalled into java objects.

My question really is how can I configure a multi-threaded MQ Listener (there is one provided by MQ) and how can I use the MQ Listener to call a java class that corresponds to my application logic.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Mon Jan 21, 2008 9:39 am Post subject: Re: MQ Listener & Business Logic Implementation Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

shayad wrote:
My question really is how can I configure a multi-threaded MQ Listener (there is one provided by MQ) and how can I use the MQ Listener to call a java class that corresponds to my application logic.


Please be more specific about what "MQ Listener" you think this is, that comes with MQ and does what you think it does.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
shayad
PostPosted: Mon Jan 21, 2008 9:58 am Post subject: MQ Listener & Business Logic Implementation Reply with quote

Newbie

Joined: 20 Jan 2008
Posts: 5

Thanks.

I was basing my question on documentation provided by WebSphere MQ.
I understand that MQ Listener is a process that has a pool of threads and then delegates the requests to application components (java objects). This was the premise behind my question.

If it helps, please see the snippet below.

On all WebSphere MQ platforms, with the exception of WebSphere MQ for z/OS,
listening on TCP/IP is performed by the WebSphere MQ listener process.
This process listens for connections to arrive on a port and then creates a
message channel agent (MCA) to process that connection, whether it is a
distributed message channel, cluster message channel, or client connection. We
discuss message channels and MCAs in 7.1.2, “Message channel agents
(MCAs)” on page 157.
The MCA created by the WebSphere MQ listener does not run within its own
process on the system. Instead, the MCA is created within a pool of processes
by the listener process. The number of processes within this pool is managed
automatically by WebSphere MQ based on the number of MCAs active for the
queue manager.
This approach is generally called channel pooling. Using channel pooling means
that each MCA requires less resources than if it were running within its own
process. A queue manager can have thousands of connections active at any
114 WebSphere MQ V6 Fundamentals
time depending on the design of the system and the loads on the queue
manager.
Listeners are created using the DEFINE LISTENER MQSC command and
started using the START LISTENER MQSC command.
In the WebSphere MQ Explorer, listeners can be created and started
automatically when creating a queue. Alternatively, create listeners by
right-clicking the Listeners folder under the queue manager in the navigator view and selecting New → Listener.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Mon Jan 21, 2008 10:14 am Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Right.

I repeat what I said earlier
Quote:
The "MQ listener" can't do this, even in JMS.

Any program that sits in a Get-with-Wait loop, however, is an "MQ listener", and can do whatever you code it to do.


You cannot use the MQ Listener process to do anything with your business logic or your applications.

The MQ Listener is not a process that has a pool of threads and then delegates the requests to application components.

You need to write your own code to do this, or look for things like the MDB Listener Ports in the JMS standard, that will cover the heavy lifting for you.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
shayad
PostPosted: Mon Jan 21, 2008 10:27 am Post subject: MQ Listener & Business Logic Implementation Reply with quote

Newbie

Joined: 20 Jan 2008
Posts: 5

Thanks for the prompt reply. However, I am still confused.

Then, what does the MQ Listener do?
Is it optional? Who picks the messages from the queue? The application components cant do that ... right?

If yes, then there has to be a transfer of control from MQ Listener to application components. How does that happen and how can it be configured?
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Mon Jan 21, 2008 10:32 am Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

The MQ listener is used by channels to move messages between queue managers.

Again, it has nothing to do with your applications.

It is always and only the responsibility of your applications to pick up your messages from your queues (and to leave everyone else's messages alone).

As I said, there are "frameworks" or "components" or etc. that can be used in at least some programming environments to make that easier for you. The MDB Listener in the JMS standard does just that - it allows you to define a Message Driven Bean, that implements an onMessage() method. When a message arrives on a queue, the MDB Listener pulls the message, and passes it to your onMessage() method.

There's a .NET equivalent, but I forget what it's called.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Mon Jan 21, 2008 10:34 am Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

To put it another way that may make it clearer to you: WebSphere MQ is a messaging transport. It is not an Application Server.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
shayad
PostPosted: Mon Jan 21, 2008 10:38 am Post subject: Reply with quote

Newbie

Joined: 20 Jan 2008
Posts: 5

Thanks!
Back to top
View user's profile Send private message
Display posts from previous:
Post new topicReply to topic Page 1 of 1

MQSeries.net Forum IndexIBM MQ Java / JMSMQ Listener & Business Logic Implementation
Jump to:



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP


Theme by Dustin Baccetti
Powered by phpBB 2001, 2002 phpBB Group

Copyright MQSeries.net. All rights reserved.