16

I was curious if anyone had any suggestions on a Java library that provides access to MSMQ? I've downloaded the trial of the J-Integra Java-COM library and have built and run their MSMQ example app, but I was curious if there were any good (free :)) alternatives. I've run across a few JNI implementations like jMSMQ and a few others, but I'd rather avoid JNI if possible.

We've also investigated some .NET<->JMS interop solutions like JNBridge (with ActiveMQ). I think our company has decided to centralize our queueing in MSMQ however, so that would be our ideal solution.

We are hoping to use WCF (netMsmq or msmqIntegration) on the .NET side. I'm a little concerned about how the java side will deal with the WCF messages (binary encoding), but there should be options there (customBinding with text encoding and MSMQ transport?), so I'm not too worried about that. Mostly worried about getting access to MSMQ in Java.

Our other option is to just put a thin web-service layer at the input end of each queue, and achieve interop that way. Performance is a little bit of a concern there, however.

Any suggestions? Thanks a lot for anyone's time.

Andy White
  • 86,444
  • 48
  • 176
  • 211

5 Answers5

11

As far as I understand J-Integra is the only pure Java implementation of MSMQ, ie this is the only alternative if you are not running on Windows. (Please let me know if there are other alternatives!)

Apache Camel and other uses JNI to access the Windows API (DLL files) which obviously means that is only works on Windows.

I am currently trying out the code provided here http://www.codeplex.com/MsmqJava which seems simple to use, but I'm not really sure how transactions work.

Jan Kronquist
  • 2,793
  • 25
  • 20
  • I didn't do anything with transactions in the MsmqJava thing. MsmqJava also relies on JNI to the MSMQ Win32 apis. I don't know a better way to do it. MSMQ does not present a (documented) remote interface. – Cheeso Mar 09 '09 at 04:31
  • J-Integra isn't completely pure either, as in it doesn't communicate directly with MSMQ using its port and protocol. The client can run on a non-Windows box, but it connects to DCOM which then connects to MSMQ. – Nelson Rothermel May 29 '14 at 19:16
  • _"Apache Camel and other uses JNI to access the Windows API (DLL files) which obviously means that is **only works on Windows**"_ - MSMQ is Windows-only anway –  Apr 29 '15 at 09:43
3

There is an open-source library on CodePlex: MsmqJava. Free.

Cheeso
  • 189,189
  • 101
  • 473
  • 713
  • In the readMe file, I see "To run the java application, you can use the runJavaClient.cmd command file. This sets up the necessary classpath and path. You can run the .NET version without any extra setup." Couldn't locate the "runJavaClient.cmd" file. Can you please help me with this? – Nikunj Madhogaria Jun 22 '18 at 11:37
2

I am author of jni4net, open source intraprocess bridge between JVM and CLR. It's build on top of JNI and PInvoke. No C/C++ code needed. I hope it will help you.

Pavel Savara
  • 3,427
  • 1
  • 30
  • 35
2

You can also try the http://javamsmq.codeplex.com/ which is also provide a complete solution of MSMQ JAVA interoperability.As well this having Unicode ASCII all functionality.In other dll based open source having memory leakage problem like crashing of application.But this open source don't having any memory leakage problem.

prashant thakre
  • 5,061
  • 3
  • 26
  • 39
1

Update: This answer no longer applies per comment:

Camel msmq component is discontinued : fusesource.com/forums/thread.jspa?messageID=6040

You might take a look at how Apache Camel does it: Apache Camel: msmq

LeBleu
  • 1,101
  • 3
  • 17
  • 28
laz
  • 28,320
  • 5
  • 53
  • 50