1

I have a wcf service that executes some code and sends a message to the IBM WebSphere MQ hosted on a linux server. I can put and get messages from the queue just fine. What I wanted to know that is there a way by which whenever a message is sent to the queue a listener service (WCF) activates to process those messages? (this can be done by using netmsmqbinding and WAS for MSMQ)

I have researched a lot but was unable to find any code examples which made me think that is this even possible....

I have looked at some answers but they don't link wcf and mq part. A similar question is WCF / WebService to act as Listener for MQ Message? but there is no concrete answer. I have also looked at Listening to new enqueued messages using WCF Service.

So this scenario lead me to think that my only option is to write a windows service that after some interval listens (polls i.e invokes the get method on) the queue or write a console application that does that same thing.

Does anyone have a more elegant solution?

Community
  • 1
  • 1
Syed Osama Maruf
  • 1,895
  • 2
  • 20
  • 37
  • The queue is in java and you want c# code to listen to java server? – ilansch Mar 20 '16 at 19:57
  • @ilansch Its a linux server that runs the IBM Websphere MQ installation... – Syed Osama Maruf Mar 20 '16 at 20:37
  • As documented here: http://www.ibm.com/support/knowledgecenter/SSFKSJ_7.5.0/com.ibm.mq.dev.doc/q029950_.htm?lang=en - you can either use self hosting or a Windows Service. – Shashi Mar 21 '16 at 05:07
  • @Shashi I looked at that and what I understood is that using a Windows Service/Self hosting I will have to periodically call the Get metod to retrieve messages from the queue. What I want to know is there any other way to do this? – Syed Osama Maruf Mar 21 '16 at 06:00
  • No, those are the two options you have. – Shashi Mar 21 '16 at 06:58
  • Hi. You didnt get my point. C# cant listen to other webservice (specially java) requests. You can create a java listener that send msg to c# app. – ilansch Mar 22 '16 at 06:09

1 Answers1

2

Triggering might be an option. WebSphere MQ can start an application when a message arrives on a queue:

http://www-01.ibm.com/support/docview.wss?uid=swg27020075&aid=1

As you want to trigger an application not running on the server of the queue manager, you will need a trigger monitor like this:

http://www-01.ibm.com/support/docview.wss?uid=swg24000149

Attila Repasi
  • 1,803
  • 10
  • 11
  • As per my understanding for triggering I will configure a trigger monitor (service) in the queue manager that will start whenever a message enters the queue. But my service will be wcf service hosted as windows service so how will the the trigger service communicate with it? Or am I missing something... – Syed Osama Maruf Apr 07 '16 at 18:27
  • 1
    If you are running the program as a windows service, you will need to issue periodic gets. Triggering could be used to start the program processing the messages, or it could be used to call a script, which starts your windows service, but I don't think it would be better then to just issue periodic gets. – Attila Repasi Apr 08 '16 at 19:40