No messages in the queues.

Hello,

I'm trying to do a very simple example of sending a message from Initiator queue to Target queue. The result is no messages are delivered.

Here's the code:

DECLARE @conversationHandle UNIQUEIDENTIFIER

BEGIN DIALOG CONVERSATION @conversationHandle

FROM SERVICE GmiInitiatorService

TO SERVICE 'GmiTargetService'

ON CONTRACT GmiContract

WITH ENCRYPTION = OFF;

SEND ON CONVERSATION @conversationHandle MESSAGE TYPE GmiMessage ('test');

END CONVERSATION @conversationHandle

All three queues are empty (Initiator, Transmission, Target). When I comment out the last line ("end conversation"), the messages get stuck in the Initiator queue.

Please help!!

Thank you.



Answer this question

No messages in the queues.

  • Robertwell

    What is the transmission_status is sys.transmission_queue

  • Phil Wherrett

    Rushi's right. These are not the same message, but the error reply sent by the target. Is probably an access denied because you don't have SEND permission on the target service.

  • Sanjay G

    Thanks for your help, guys.

    I found what the problem was. The services weren't tied to any contract.

    I had to run the following two commands:

    ALTER SERVICE [GmiInitiatorService] (ADD CONTRACT [GmiContract]) ;

    ALTER SERVICE [GmiTargetService] (ADD CONTRACT [GmiContract]) ;


  • Biri

    You need to do that only for the target service, by the way.

    In general, is better when you post with a problem to add the complete DDL you use, we could had spotted the problem just by looking at the CREATE SERVICE.



  • joost g.

    The messages don't even get to the transmission queue. They stuck up in the Initiator queue.
  • Jian Hu

    Use CAST or CONVERT. E.g.:

    RECEIVE cast(message_body as xml) FROM queuename
    SELECT cast(message_body as xml) FROM queuename
    SELECT cast(message_body as nvarchar(max)) FROM queuename
    etc...



  • Claudio Maras

    How do I give permissions to the target service

    Thanks.


  • iHD

    Thanks.

    The message body says "The service contract 'GmiContract' is not found."

    I checked the contract and it's there. GmiContract.


  • surajguru

    When you don't end the conversation, the message you are seeing in the initiator queue is probably an error message sent by the target service. This could be due to security or metadata issues. Look at the message body to find out more.

    As a rule, you should not end the conversation if you care about error messages being sent by the target.


  • Raj-Xps

    The message body in the Initiator queue is of varbinary(max) datatype. How do I convert it to the readable format
  • No messages in the queues.