Using StompConnect and Open MQ Cannot resolve external resource into attachment.

If you are interested in contributing to this FAQ, please read the Contribution Guidelines.
Please note that these samples are posted for the benefit of the community. These samples are intended to help you understand how you can use Open MQ in various integration and application settings. Use of these samples is at your own risk.

We welcome your feedback – users@mq.java.net
Back to Open MQ


The following illustrates how you can use StompConnect as an Integration facility for Open MQ.

Getting Started

Before you begin, you'll need the following:
StompConnect

File System JNDI Service Provider:

  • fscontext.jar - dependency because of #3, below
  • providerutil.jar - dependency because of #3, below

download from http://java.sun.com/products/jndi/downloads/index.html

  • StompClient.cs (.zip) - Example C# Client
  • imq.jar - MQ client runtime
  • jms.jar - dependency of MQ client runtime and StompConnect

Steps to run the C# Stomp Client

For this example, you'll need a machine with Microsoft .NET framework to host the C# bits. You can run the MQ Broker on any supported platform.
1. Start MQ broker
for example,

imqbrokerd -tty

2. Create the MQ administrative object of ConnectionFactory
for example, with the broker you started in the previous step:

imqobjmgr add -t qf -l cn=QCF -j "java.naming.factory.initial=com.sun.jndi.fscontext.RefFSContextFactory" -j "java.naming.provider.url=file:///C:/mq_admin_objects"

3. Create a JNDI resource file jndi.properties for Stomp Connect
for example, in the previous step you created a jndi.properties which now contains:

java.naming.factory.initial=com.sun.jndi.fscontext.RefFSContextFactory
java.naming.provider.url=file:///C:/mq_admin_objects

place this jndi.properties file in the classpath for the instance of StompConnect that you're about to start in the next step

4. Start StompConnect
for example, with step #2 above, on the broker running machine,

java -classpath <classpath> org.codehaus.stomp.jmsMain tcp://localhost:6666 cn=QCF

5. Create your Stomp Client
On a Windows machine that has Microsoft .NET Framework
(can be the same machine or different machine from the one you just used in the previous step)
(1) Compile the StompClient.cs

csc Stompclient.cs

(2) Run the StompClient
a. To run as sender

StompClient s <stompconnect-host> <stompconnect-port> <queue-name>

for example, with the StompConnect instance you started in step 4 above,

StompClient s <stompconnect-host> 6666 <queue-name>

b. to run as receiver

StompClient r <stompconnect-host> <stompconnect-port> <queue-name>