S
Stephan Steiner
Hi
I have a remoting based even publish and subscribe mechanism in place which
works quite fine. However, due to the distributed architecture, it can be
that the publisher might at some point be inaccessible - and if it comes
back up, the subscriber has to re-subscribe (similarly, the publisher will
remove the appropriate event handler if the event cannot be raised anymore
at some point - in order to do this, I'm iterating over the registered
subscribers by calling mydelegate.GetInvocationList()).
So far, I only had one subscriber, so when I was polling the publisher, I
simply checked a boolean variable which I set to true when the subscriber
made the subscription.
However, in preparing for multiple subscribers, I can no longer use a
boolean - so I'm keeping a data table instead. However, now I need some way
for a subscriber to ask the publisher if he is still registered to receive
event notifications... I tried using the hashcode of the delegate, but it
has a different value on the publisher and subscriber so that's out. While I
can get the IP address of the subscriber, that also doesn't fly because
there's a NAT on the way (for the publisher, every subscriber but a
subscriber running on the local machine has the same IP).
I figure I need to be able to add some kind of unique identifier when
subscribing to the event
class.Event += eventHandler;
However, since I cannot inherit from MulticastDelegate I'm also stuck that
way.
So, is there another way to get some kind of unique identifier across so
that a subscriber can at some point query the publisher "am I still
registered for event notification" (preferably something more simplistic
than writing my own sinks on server and client application to inject a
unique identifier into the connection on the client side so that it can be
extracted again on the server side):
Regards
Stephan
I have a remoting based even publish and subscribe mechanism in place which
works quite fine. However, due to the distributed architecture, it can be
that the publisher might at some point be inaccessible - and if it comes
back up, the subscriber has to re-subscribe (similarly, the publisher will
remove the appropriate event handler if the event cannot be raised anymore
at some point - in order to do this, I'm iterating over the registered
subscribers by calling mydelegate.GetInvocationList()).
So far, I only had one subscriber, so when I was polling the publisher, I
simply checked a boolean variable which I set to true when the subscriber
made the subscription.
However, in preparing for multiple subscribers, I can no longer use a
boolean - so I'm keeping a data table instead. However, now I need some way
for a subscriber to ask the publisher if he is still registered to receive
event notifications... I tried using the hashcode of the delegate, but it
has a different value on the publisher and subscriber so that's out. While I
can get the IP address of the subscriber, that also doesn't fly because
there's a NAT on the way (for the publisher, every subscriber but a
subscriber running on the local machine has the same IP).
I figure I need to be able to add some kind of unique identifier when
subscribing to the event
class.Event += eventHandler;
However, since I cannot inherit from MulticastDelegate I'm also stuck that
way.
So, is there another way to get some kind of unique identifier across so
that a subscriber can at some point query the publisher "am I still
registered for event notification" (preferably something more simplistic
than writing my own sinks on server and client application to inject a
unique identifier into the connection on the client side so that it can be
extracted again on the server side):
Regards
Stephan