12

Perhaps I am barking up the wrong tree - but I have a set of services (WebAPI and WCF) that use WebSphere MQ to interact with other systems.

This works without issue - until I now need to find a way of listening for messages on one of the queues.

Is this even possible, or do I need to go down the windows Service route?

BlueChippy
  • 5,935
  • 16
  • 81
  • 131
  • This link will help you: http://www-01.ibm.com/support/knowledgecenter/SSFKSJ_7.5.0/com.ibm.mq.dev.doc/q029950_.htm – Shashi May 10 '15 at 15:39
  • 1
    @Shashi - I can't see anything in the documentation about how to set up the WebSphere end to appear to be a WCF service? – BlueChippy May 24 '15 at 10:48
  • The link describes the two hosting options supported by MQ WCF - Self hosted and Windows Service. – Shashi May 25 '15 at 06:37
  • Yes...and as per IBM norm it does so very very poorly and with no thought to actual use! I am looking for a real-world answer to this. – BlueChippy May 26 '15 at 05:37
  • @BlueChippy Did you find a solution to this? – Syed Osama Maruf Mar 21 '16 at 16:44
  • Sort of - follow the instructions with WebSphere and the examples...but you MUST have the 64 bit and latest version. Older versions simply don't (didn't) work correctly. You end up with WS "calling" your application, which can then read your MQ queue. Not really listening, but the best we could achieve. – BlueChippy Jun 28 '16 at 07:45

4 Answers4

4

You could write a Windows service that is continually calling MQ Get on the queue, and invokes a WCF service to process the message. Or you could write a trigger program (a console application) that MQ will launch for you when a message arrives, that invokes the WCF service.

Mike Stockdale
  • 5,256
  • 3
  • 29
  • 33
2

I might be just better at googling than you are, but I seem to have found the answer here.

Seems you want to load the IBM binding configuration in you app.config

<extensions>
  <bindingElementExtensions>
    <add name="IBM.XMS.WCF.SoapJmsIbmTransportChannel" 
           type="IBM.XMS.WCF.SoapJmsIbmTransportBindingElementConfig, IBM.XMS.WCF, Version=7.5.0.0, Culture=neutral, PublicKeyToken=8c7c0be90afcd8ba"/>
  </bindingElementExtensions>
</extensions>

Then you can add a WebSphere WCF binding config.

<bindings>
  <customBinding>
    <binding name="CustomBinding_WMQ">
      <textMessageEncoding messageVersion="Soap11" />
      <IBM.XMS.WCF.SoapJmsIbmTransportChannel />
    </binding>
  </customBinding>
</bindings>
Aron
  • 15,464
  • 3
  • 31
  • 64
  • Thanks - one thing I haven't found yet is what I need to do on the Websphere side? e.g. How do I make it appear as a service? – BlueChippy Jun 07 '15 at 09:24
  • Gone through this and it is the opposite to what I am trying to do! This allows me to write to MQ, using JMS, and then read the reply back. What I would like is to listen to the queue for another application to write a message, then use WCF Service to process the message. – BlueChippy Jun 09 '15 at 10:57
1

Your problem can be broken down into two distinct elements:

  1. How to integrate MQ with a WCF-supported transport
  2. How to expose a WCF endpoint over this transport

To address the first issue, you should look at the MQ-MSMQ bridge which ships with Host Integration Server up to version 2009 (not R2), which allows you to have messages delivered to MQSeries queues forwarded to local MSMQs in windows. Although this feature is deprecated it's probably the easiest way if you have a MSDN license.

Another way of addressing this issue is to use BizTalk server which ships with a MQSeries adapter, though unless you're using BizTalk currently in your enterprise I would avoid.

The last way you could do this is to program directly against the MQSeries .NET client libraries or via the XMS client.

If you manage to solve the first issue then solving the second one is easy enough. You can expose one way WCF service operations over msmq transport by using the netMsmqBinding (for WCF on both ends), or msmqIntegrationBinding for clients using System.Messaging or native msmq COM libraries.

This in-effect acts as a listener service, with messages being handled by the service operation.

tom redfern
  • 30,562
  • 14
  • 91
  • 126
0

how to get connect with ibm websphere mq by using c#.net

Perhaps you could use the above answer and within that queue consumer app create a "Service Reference" to your WCF service.

Community
  • 1
  • 1
JDPeckham
  • 2,414
  • 2
  • 23
  • 26