none
[E2010] [EWSMA] [C#] Using one streaming subscription connection to monitor several mailboxes and using autodiscover. RRS feed

  • Question

  • Looking at the EWSMA I see that you can add several subscriptions to one streaming connection. What are the implications of doing this for different mailboxes? In my current service I need to monitor 12~ different mailboxes for different event types. My initial idea was to simply use one `StreamingSubcriptionConnection` with all 12 streaming subscriptions.

    What are the implications of doing this seeing as all 12 mailboxes could resolve to a different autodiscovered URL? Is adding several streaming subscriptions to one connection meant to monitor different event types from the same mailbox going to cause any problems? Essentially, must I create one `StreamingSubscriptionConnection` per mailbox that I wish to monitor. I ask because I recently learned (from a MSDN blog) that you should autodiscover the URL at least once an hour in case the mailbox moves and gets services by a different client access server. Having learned that it appears that you could potentially shoot yourself in the foot if you limit yourself to one streaming subscription connection because mailboxes could move around.

    Could someone please confirm?

    Thank you.


    • Edited by michaelc.h1 Tuesday, July 10, 2012 12:32 PM
    Wednesday, July 4, 2012 12:22 PM

Answers

  • Hello Michael,

    We highly suggest that you use one connection to monitor many streaming subscriptions. We recommend that you use up to 200 subscriptions per connection. See More throttling changes for Exchange Online for more information about limits for Exchange Online. Connection limits are less restrictive for on-premise Exchange server.

    You ask a great question about using a single connection for many subscriptions when the mailboxes are serviced from different endpoints. Subscription state is maintained on the CAS server so we suggest you bundle your subscriptions by endpoint so that the same CAS handles the requests. I'm not sure if streaming event information is proxied between CAS servers. If it is, it is costing cycles.  If it isn't, then the subscriptions wouldn't be available from a different CAS. I suggest that you bundle your subscriptions based on service endpoint, one connection per endpoint with many subscriptions per connection.

    Regarding Autodiscover, I suggest you Autodiscover once a day and when you experience EWS error codes related to not finding the correct endpoint. Once an hour is too frequent; mailboxes don't move that often and transient errors conditions are often resolved in much shorter periods. 

    Which MSDN blog states that you should use Autodiscover once an hour?

    Here are some error codes that may indicate a need to use Autodiscover:

    ErrorMailboxMoveInProgress
    ErrorMailboxStoreUnavailable
    ErrorNoDestinationCASDueToKerberosRequirements
    ErrorNoDestinationCASDueToSSLRequirements
    ErrorNoDestinationCASDueToVersionMismatch
    ErrorNoRespondingCASInDestinationSite
    ErrorProxiedSubscriptionCallFailure
    ErrorProxyCallFailed
    ErrorAutoDiscoverFailed
    ErrorConnectionFailed
    ErrorIncorrectSchemaVersion
    ErrorInvalidCrossForestCredentials
    ErrorInvalidIdReturnedByResolveNames
    ErrorInvalidNetworkServiceContext
    ErrorMailboxMoveInProgress
    ErrorMailboxStoreUnavailable
    ErrorNameResolutionNoMailbox
    ErrorNameResolutionNoResults
    ErrorNotEnoughMemory

    Here is a good blog post about when to use Autodiscover: http://blogs.msdn.com/b/mstehle/archive/2010/11/09/ews-best-practices-use-autodiscover.aspx

    With regards,


    Michael | Microsoft Exchange SDK

    The Exchange Development Forum Guide has useful information for using the Exchange Development Forum.

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    • Marked as answer by michaelc.h1 Wednesday, July 11, 2012 7:00 PM
    Tuesday, July 10, 2012 10:16 PM
    Moderator

All replies

  • Could someone please help me with this? Is it perhaps not very clear?

    I will edit my question.

    Thank you.

    Tuesday, July 10, 2012 12:22 PM
  • Hello Michael,

    We highly suggest that you use one connection to monitor many streaming subscriptions. We recommend that you use up to 200 subscriptions per connection. See More throttling changes for Exchange Online for more information about limits for Exchange Online. Connection limits are less restrictive for on-premise Exchange server.

    You ask a great question about using a single connection for many subscriptions when the mailboxes are serviced from different endpoints. Subscription state is maintained on the CAS server so we suggest you bundle your subscriptions by endpoint so that the same CAS handles the requests. I'm not sure if streaming event information is proxied between CAS servers. If it is, it is costing cycles.  If it isn't, then the subscriptions wouldn't be available from a different CAS. I suggest that you bundle your subscriptions based on service endpoint, one connection per endpoint with many subscriptions per connection.

    Regarding Autodiscover, I suggest you Autodiscover once a day and when you experience EWS error codes related to not finding the correct endpoint. Once an hour is too frequent; mailboxes don't move that often and transient errors conditions are often resolved in much shorter periods. 

    Which MSDN blog states that you should use Autodiscover once an hour?

    Here are some error codes that may indicate a need to use Autodiscover:

    ErrorMailboxMoveInProgress
    ErrorMailboxStoreUnavailable
    ErrorNoDestinationCASDueToKerberosRequirements
    ErrorNoDestinationCASDueToSSLRequirements
    ErrorNoDestinationCASDueToVersionMismatch
    ErrorNoRespondingCASInDestinationSite
    ErrorProxiedSubscriptionCallFailure
    ErrorProxyCallFailed
    ErrorAutoDiscoverFailed
    ErrorConnectionFailed
    ErrorIncorrectSchemaVersion
    ErrorInvalidCrossForestCredentials
    ErrorInvalidIdReturnedByResolveNames
    ErrorInvalidNetworkServiceContext
    ErrorMailboxMoveInProgress
    ErrorMailboxStoreUnavailable
    ErrorNameResolutionNoMailbox
    ErrorNameResolutionNoResults
    ErrorNotEnoughMemory

    Here is a good blog post about when to use Autodiscover: http://blogs.msdn.com/b/mstehle/archive/2010/11/09/ews-best-practices-use-autodiscover.aspx

    With regards,


    Michael | Microsoft Exchange SDK

    The Exchange Development Forum Guide has useful information for using the Exchange Development Forum.

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    • Marked as answer by michaelc.h1 Wednesday, July 11, 2012 7:00 PM
    Tuesday, July 10, 2012 10:16 PM
    Moderator
  • Awesome answer.

    When I call Autodiscover once a day do I need to do anything else such as reconnecting my streaming subscription or will it take care of itself?

    Lastly, it's quite possible that I misunderstood the blog entry but you can find it here.

    Wednesday, July 11, 2012 2:32 PM
  • Hello michaelc.h1,

    I think you correctly understood the blog post. It looks like that is how Outlook 2007 performs Autodiscover. I think once every hour is unnecessary but it would work fine. I do agree that everytime the application reboots and when the connection to Exchange fails, it should Autodiscover; I'd add those two conditions to my list.

    If your application becomes disconnected from the service, as in it becomes unavailable to receive the hanging notifications, the connection should timeout and you will need to re-subscribe. If the Autodiscover call indicates that the service endpoint has changed, then you will need to resubscribe. The event queue on the old CAS is not transferred to the new CAS as far as I know. So, at that point, you will want to do a search on the items in the monitored folders and find all items that have changed since you performed your last notification triggered synchronization. You will then want to get those changed items and then resubscribe to the notification subscription to start monitoring for future changes.  

    With regards,


    Michael | Microsoft Exchange SDK

    The Exchange Development Forum Guide has useful information for using the Exchange Development Forum.

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    Wednesday, July 11, 2012 5:12 PM
    Moderator
  • Thanks for the detailed answer.

    Thank you.

    Wednesday, July 11, 2012 7:00 PM