cancel
Showing results for 
Search instead for 
Did you mean: 

MDB with remote JMS queue

Former Member
0 Kudos

Hi,

I have a message driven bean that I want to connect to a jms queue on a remote box.

From looking at this web page, it seems to be possible by adding in the activation property.

https://help.sap.com/saphelp_nwce10/helpdata/en/85/63eeb0acbb49009e66f5f391b2bb7e/frameset.htm

However, everytime i try to deploy the mdb, it fails, with it trying to lookup the connection factory on the local instance.

Should I be creating a local instance of the connection factory which links to a remote connection factory on the other instance??

Or am i going about this the wrong way?

Regards,

Andrew

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi.

Apologies for the delay.. hopefully this will help clarify things.

MDB is on a CE instance on box 'A'

I want to consume messages from a queue on box 'B', which is a CE instance as well

2 completely different CE installations / SIDs, etc.

Regards,

Andrew

Vlado
Advisor
Advisor
0 Kudos

Hi Andrew,

In this case you would treat the SAP JMS Provider hosting the remote queue on box B as a "third party" JMS provider, as described in this [document|http://help.sap.com/saphelp_nwce711/helpdata/en/46/6e52823abf7185e10000000a114a6b/frameset.htm].

You have to use the first option, <context-factory-type>. In case both CE systems are of the same version, you don't even have to deploy a JMS library as described in step 4 and can leave the <library-name> element out.

Here is a sample jms-resources.xml:


<?xml version=u201D1.0u201D encoding=u201DUTF-8"?>
<jms-resources xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="jms-resources.xsd">
   <connection-factory>
      <name>MyConnectionFactory</name>
      <context-factory-type>
         <initial-context-properties>
            <initial-context-factory>com.sap.engine.services.jndi.InitialContextFactoryImpl</initial-context-factory>
            <provider-url>hostB:50004</provider-url>
            <security-principal>Administrator</security-principal>
            <security-credentials>admin_password</security-credentials>
         </initial-context-properties>
         <link-factory-name>
            jmsfactory/default/XAQueueConnectionFactory
         </link-factory-name>
      </context-factory-type>
   </connection-factory>

   <destination>
      <name>MyQueue</name>
      <type>javax.jms.Queue</type>
      <external-destination-type>
         <link-connection-factory>
            MyConnectionFactory
            <!-- This name has to be the same as the name of the connection factory -->
         </link-connection-factory>
      </external-destination-type>
   </destination>
</jms-resources>

Then, in the MessageDriven annotation you just need to use the above connection factory and destination.

HTH!

-- Vladimir

Answers (3)

Answers (3)

ekaterinamitova
Advisor
Advisor
0 Kudos

Hi Andrew,

I recommend you to read this documentation related to MDBs: http://help.sap.com/saphelp_nwce711/helpdata/en/47/4addcc9d1b2207e10000000a155369/frameset.htm

It might give answers to some of your questions.

If you need to use third-party JMS Provider, I've described how you can do it in the following document:

http://help.sap.com/saphelp_nwce711/helpdata/en/46/6e52823abf7185e10000000a114a6b/frameset.htm

I will be glad to receive any feedback concerning these documents.

Best regards,

Ekaterina

Vlado
Advisor
Advisor
0 Kudos

In addition to what Vesselin said, it would also be helpful if you could clarify what you mean by local and remote instance/box. Are these instances on the same SAP system (same SID) or are they totally separate systems? If the latter, are they both SAP or is the remote "instance" running a third party JMS provider (like MQ Series)?

Regards,

-- Vladimir

0 Kudos

Hi Andrew,

Do you mean that you want your MDB to consume JMS messages from a Queue; or you want your MDB, once received some message, to send another JMS message to a remote Queue?

If the first one is true, then you can either skip the connectionFactoryName property (it is optional), or set it to a correct one - means existing on the local server and used by the JMS client for sending the messages.

If latter, then you should not set the connectionFactoryName as a activation-config property, but rather use the standard JMS API for sending the message in a programming manner - connect to the remote server, lookup factory, create connection and session, and then send the message.

The activation config properties are only important when the MDB consumes messages. When it sends, the standard JMS API should be used.

If this info does not help much, please give more details on your scenario.

Cheers,

Vesselin