VENDAS: 1-800-867-1389

 none
Why can't I create a subscription client for topic subscription?

    Pergunta

  • Hi again,

    ----> Microsoft.ServiceBus.Messaging.MessagingException : Cannot open a 
    Subscriber client for entity type 
    Topic..TrackingId:3853d241-42df-46a3-82c4-fc6da5fa466b_4_2,TimeStamp:1/2 
    7/2012 12:28:59 PM ----> 
    System.ServiceModel.FaultException`1[System.ServiceModel.ExceptionDetail 
    ] : Cannot open a Subscriber client for entity type 
    Topic..TrackingId:3853d241-42df-46a3-82c4-fc6da5fa466b_4_2,TimeStamp:1/2 
    7/2012 12:28:59 PM at 
    System.Threading.Tasks.Task.ThrowIfExceptional(Boolean 
    includeTaskCanceledExceptions) at System.Threading.Tasks.Task.Wait(Int32 
    millisecondsTimeout, CancellationToken cancellationToken) at 
    System.Threading.Tasks.Task`1.get_Result() 
    Assumptions\Should_be_possible_to_drain.cs(58,0): at 
    MassTransit.Transports.ServiceBusQueues.Tests.Assumptions.Should_be_poss 
    ible_to_recieve_ordinarily_through_API.by_calling_BeginReceive_EndReceiv 
    e() --MessagingException Server stack trace: at 
    Microsoft.ServiceBus.Messaging.Sbmp.SbmpMessageReceiver.EndReceiveComman 
    d(IAsyncResult result, IEnumerable`1& messages) at 
    Microsoft.ServiceBus.Messaging.Sbmp.SbmpMessageReceiver.ReceiveAsyncResu 
    lt.<GetAsyncSteps>b__35(ReceiveAsyncResult thisPtr, IAsyncResult a) at 
    Microsoft.ServiceBus.Messaging.IteratorAsyncResult`1.StepCallback(IAsync 
    Result result) Exception rethrown at [0]: at 
    Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult 
    result) at 
    Microsoft.ServiceBus.Messaging.Sbmp.SbmpMessageReceiver.OnEndTryReceive( 
    IAsyncResult result, IEnumerable`1& messages) at 
    Microsoft.ServiceBus.Messaging.OpenOnceManager.OpenOnceManagerAsyncResul 
    t`1.BeginOperationCallback(IAsyncResult result) Exception rethrown at 
    [1]: at 
    Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult 
    result) at 
    Microsoft.ServiceBus.Messaging.MessageReceiver.EndTryReceive(IAsyncResul 
    t result, IEnumerable`1& messages) at 
    Microsoft.ServiceBus.Messaging.MessageReceiver.EndReceive(IAsyncResult 
    result) at 
    System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult 
    iar, Func`2 endMethod, TaskCompletionSource`1 tcs) --FaultException`1 
    Server stack trace: at 
    Microsoft.ServiceBus.Messaging.Sbmp.DuplexRequestBindingElement.DuplexRe 
    questSessionChannel.ThrowIfFaultMessage(Message wcfMessage) at 
    Microsoft.ServiceBus.Messaging.Sbmp.DuplexRequestBindingElement.DuplexRe 
    questSessionChannel.HandleMessageReceived(IAsyncResult result) Exception 
    rethrown at [0]: at 
    Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult 
    result) at 
    Microsoft.ServiceBus.Messaging.Sbmp.DuplexRequestBindingElement.DuplexRe 
    questSessionChannel.EndRequest(IAsyncResult result) at 
    Microsoft.ServiceBus.Messaging.Channels.ReconnectBindingElement.Reconnec 
    tChannelFactory`1.RequestSessionChannel.RequestAsyncResult.<GetAsyncStep 
    s>b__13(RequestAsyncResult thisPtr, IAsyncResult r) at 
    Microsoft.ServiceBus.Messaging.IteratorAsyncResult`1.StepCallback(IAsync 
    Result result) Exception rethrown at [1]: at 
    Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult 
    result) at 
    Microsoft.ServiceBus.Messaging.IteratorAsyncResult`1.End(IAsyncResult 
    asyncResult) at 
    Microsoft.ServiceBus.Messaging.Channels.ReconnectBindingElement.Reconnec 
    tChannelFactory`1.RequestSessionChannel.EndRequest(IAsyncResult result) 
    at 
    Microsoft.ServiceBus.Messaging.Sbmp.SbmpMessageReceiver.EndReceiveComman 
    d(IAsyncResult result, IEnumerable`1& messages) 0 passed, 1 failed, 0 
    skipped, took 6,78 seconds (NUnit 2.5.10). 
    

    Here's what API methods I'm calling:

    394 [TestRunnerThread] DEBUG MassTransit.Transports.ServiceBusQueues.Internal.WhatTheAPIShouldHaveDoneForMe (null) - begin topic exists @ 'sample-topic'
    4576 [15] DEBUG MassTransit.Transports.ServiceBusQueues.Internal.WhatTheAPIShouldHaveDoneForMe (null) - end topic exists @ 'sample-topic'
    4580 [15] DEBUG MassTransit.Transports.ServiceBusQueues.Internal.WhatTheAPIShouldHaveDoneForMe (null) - begin create topic @ 'sample-topic'
    5087 [9] DEBUG MassTransit.Transports.ServiceBusQueues.Internal.WhatTheAPIShouldHaveDoneForMe (null) - end create topic @ 'sample-topic'
    5105 [TestRunnerThread] DEBUG MassTransit.Transports.ServiceBusQueues.TopicImpl (null) - create client called( mode: PeekMode.PeekLock, name: '', autoSub: False)
    5116 [13] DEBUG MassTransit.Transports.ServiceBusQueues.Internal.WhatTheAPIShouldHaveDoneForMe (null) - create topic client for topic @ 'TopicDescription={ Path:'sample-topic' }'
    5194 [13] DEBUG MassTransit.Transports.ServiceBusQueues.TopicClientImpl (null) - created @ 'sample-topic'
    5194 [13] DEBUG MassTransit.Transports.ServiceBusQueues.Internal.WhatTheAPIShouldHaveDoneForMe (null) - create topic client done for topic @ 'TopicDescription={ Path:'sample-topic' }'
    5197 [TestRunnerThread] DEBUG MassTransit.Transports.ServiceBusQueues.TopicClientImpl (null) - being create message receiver @ SubscriptionDescription={ TopicPath:'sample-topic', Name:'xignifbhjkqoonbepbxv' }
    5210 [15] DEBUG MassTransit.Transports.ServiceBusQueues.TopicClientImpl (null) - end create message receiver @ SubscriptionDescription={ TopicPath:'sample-topic', Name:'xignifbhjkqoonbepbxv' }
    

    It stems from the fact that there's no BeginCreateSubscription client, at its heart, but also that there's nothing saying that a MessageReceiver can't listen to a topic (at least I've seen doc stating a MessageReceiver can handle both topic and queues as sources).

    How do I interpret this? Is the MessageReceiver the way to move forward at all? Is there HTTP communication when I call CreateSubscriptionClient? And what is an Entity?





    • Editado this is santa quinta-feira, 15 de março de 2012 14:27 Clarified title
    sexta-feira, 27 de janeiro de 2012 12:33

Respostas

  • I see, so the answer is:

    Note that when you create a MessageReceiver for subscriptions, the entityPath parameter is of the form topicPath/subscriptions/subscriptionName. Therefore, to create a MessageReceiver for the Inventory subscription of the DataCollectionTopic topic, entityPath must be DataCollectionTopic/subscriptions/Inventory.

    Thanks for the clarification. If you would add it to the code-docs as well, I would be an even happier camper.

    • Marcado como Resposta this is santa segunda-feira, 19 de março de 2012 15:49
    segunda-feira, 19 de março de 2012 15:49
  • Done. Thanks for your feedback!
    terça-feira, 20 de março de 2012 20:56
    Moderador

Todas as Respostas

  • Hmm, subscription client works, but not message receiver.
    • Marcado como Resposta this is santa sexta-feira, 27 de janeiro de 2012 12:55
    • Editado this is santa sexta-feira, 27 de janeiro de 2012 13:02
    • Não Marcado como Resposta this is santa sexta-feira, 27 de janeiro de 2012 13:02
    sexta-feira, 27 de janeiro de 2012 12:55
  • Hi,

    Can you provide more information? How do you use MessageReceiver? You can refer to http://msdn.microsoft.com/en-us/library/windowsazure/microsoft.servicebus.messaging.messagereceiver.aspx for a sample.

     

    Best Regards,

    Ming Xu.


    Please mark the replies as answers if they help or unmark if not.
    If you have any feedback about my replies, please contact msdnmg@microsoft.com.
    Microsoft One Code Framework
    segunda-feira, 30 de janeiro de 2012 11:09
    Moderador
  • In order to receive messages you need to create a subscription and connect to it.

    With a topic client you an only send messages to the topic (which may end up with multiple subscriptions).

    Your trace imply that you are not providing the correct path when creating the subscription client (of either the topic or subscription)

    Another reason might be the usage of sessions. when you create the subscription, you may specify usage of sessions. If this is the case, you need to first accept the session and only later accept messages (from the messageSession object).

    regards,

    Ziv, Azure Service Bus team


    quarta-feira, 1 de fevereiro de 2012 19:24
  • No, that's not a sample for a message receiver of a topic.
    terça-feira, 28 de fevereiro de 2012 19:46
  • The docs on MessageReceiver are as follows:

    Receives messages from the message container and acknowledges them. . Although you can use the QueueClient class to send and receive messages without creating a MessageReceiver object, you can also use MessageSender and MessageReceiver to create a sender and receiver on an entity without knowing whether it is a topic or a queue.

    I'd like to use that functionality, because just as the docs say, I don't really care whether it's a topic or queue that I get the message off.

    So, when I do:

    1. BeginCreateTopic + End...
    2. BeginCreateSubscription + End...
    3. BeginCreateMessageReceiver + End...

    I get the above mentioned exception.

    terça-feira, 28 de fevereiro de 2012 19:56
  • Hi Santa,

    "Although you can use the QueueClient class to send and receive messages without creating a MessageReceiver object, you can also use MessageSender and MessageReceiver to create a sender and receiver on an entity without knowing whether it is a topic or a queue."

    This is not exactly true, the docs seem to be a bit missleading here.

    You can do the following:

    • Create a MessageSender for a queue.
    • Create a MessageReceiver for a queue.
    • Create a MessageSender for a topic.
    • Create a MessageReceiver for a subscription.

    You cannot:

    • Create a MessageReceiver for a topic, you can only send messages to a topic.
    • Create a MessageSender for a subscription, you can only receive messages from a subscription.

    Hope this helps.

    Regards,

    Alan


    http://www.CloudCasts.net - Community Webcasts Powered by Azure


    segunda-feira, 5 de março de 2012 12:08
  • I'm in charge of the documentation for the Service Bus, and I agree this is somewhat misleading. I'll make sure the API reference gets changed per Alan's information.

    Thanks,
    Seth

    sexta-feira, 9 de março de 2012 00:22
    Moderador
  • But I'm having trouble with your IS-OK-point number 4, create a **MessageReceiver** for a **subscription**?
    quinta-feira, 15 de março de 2012 14:25
  • Thank you Seth.
    quinta-feira, 15 de março de 2012 14:26
  • Just to confirm, this has been clarified in the published MSDN documentation.

    Are you still having trouble creating a MessageReceiver for a Subscription? Check out this topic for some semantics on how to do that: http://msdn.microsoft.com/en-us/library/hh699844(VS.103).aspx. Please ping us back if you're still having trouble.

    Thanks,
    Seth Manheim
    Microsoft

    quinta-feira, 15 de março de 2012 21:52
    Moderador
  • I see, so the answer is:

    Note that when you create a MessageReceiver for subscriptions, the entityPath parameter is of the form topicPath/subscriptions/subscriptionName. Therefore, to create a MessageReceiver for the Inventory subscription of the DataCollectionTopic topic, entityPath must be DataCollectionTopic/subscriptions/Inventory.

    Thanks for the clarification. If you would add it to the code-docs as well, I would be an even happier camper.

    • Marcado como Resposta this is santa segunda-feira, 19 de março de 2012 15:49
    segunda-feira, 19 de março de 2012 15:49
  • Done. Thanks for your feedback!
    terça-feira, 20 de março de 2012 20:56
    Moderador