cancel
Showing results for 
Search instead for 
Did you mean: 

Read data from a external Message Queue inside WAS

Former Member
0 Kudos

Hi,

I would like to know the simplest approach for connection to and reading data from an external message queue inside WAS. Have you guys any information to share on this?

Regards,

Christian

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Thanks!

According to the link above I think i know the logic needed to connect and read from a queue. Now a last question from a quy who doesn't come from the J2EE world...

How would you typically initiate the reading of the message queue (or the registration of a MessageListener)?

- I just need a mechanizm to automatically start a "thread" which continiously can read messages from the queue - would you need to deploy a EJB for this purpose or is there a simpler way?

Former Member
0 Kudos

Hello Christian,

Usually it's not recommended to start threads from within J2EE applications. Since in that you interfere with the server management resources. It's forbidden by the EJB specification to do so from a bean in the EJB container.

The recommended way to receive messages is via MDB - whenever your application is started it will start receiving messages from your destination and the server will start invoking your onMessage() method.

Just have a look at any MDB/JMS tutorial.

The "not recommended" way is to start a new thread and to poll there from your destination by using synchronous JMS message listeners (like for example a call to receiver.receiveNoWait()) or by registering your own implementation of asynchronous MessageListeners (that by the way is very close to the MDB idea, however you will not be able to benefit from the built-in MDB scaling, performance benefits, transaction and security handling that can be easily tuned with your deployment descriptors even after the application has been created)

HTH

Peter

former_member182372
Active Contributor
0 Kudos

Hi Christian,

I would propose to use servlet with property load-on-startup and put the logic of MessageListener registration to the init method.

Best regards, Maksim Rashchynski.

Answers (3)

Answers (3)

Former Member
0 Kudos

Thanks Guys!

It's a SonicMQ message queue which we need to read messages from.

/ C

former_member182372
Active Contributor
0 Kudos

Are you familiar with http://www.sonicsoftware.com/products/sonicmq/documentation/index.ssp

SonicMQ® V7.0 Application Programming Guide (2.8 MB, pdf)

Takes you through the

Java

sample applications to describe the design patterns they offer for your applications. Details each facet of the client functionality: connections, sessions, transactions, producers and consumers, destinations, messaging models, message types and message elements. Complete information is included on hierarchical namespaces, recoverable file channels and distributed transactions.

Former Member
0 Kudos

Hello Christian,

The SAP Web AS comes with a built-in JMS provider which is used by default. However the server also supports easily switching to another JMS provider - SonicMQ in your case. This is done by the service JMS connector.

Just have a look at :

<a href="http://help.sap.com/saphelp_nw04/helpdata/en/cd/4d4941abbb4c0de10000000a1550b0/content.htm">integrating external JMS provider</a>

HTH

Peter

Former Member
0 Kudos

Which is this external Message queue? a lot of things depend upon the destination you are trying to connect to and hence the question. May be if you can specifically name a product like websphere mq , sonic mq or so??

former_member182372
Active Contributor
0 Kudos

Hi Christian,

Isn`t it good enough http://help.sap.com/saphelp_nw04/helpdata/en/4a/d33cc46d204ad4aeafcd43fc325044/frameset.htm ?

Best regards, Maksim Rashchynski.