Archived

This forum has been archived. Please start a new discussion on GitHub.

Publisher and Subscriber

I'm building an IceStorm app where every Ice object is both a publisher and subscriber to a topic.

Is there a way to stop the subscriber from receiving the events published from the same object?

I could be going about this totally wrong because I just started working with Ice.

Thanks,
Pete

Comments

  • matthew
    matthew NL, Canada
    There is currently no way to do that. This would be a form of event filtering, a feature which is quite common to event publishing systems. If you are interested in sponsoring the addition of such a feature to IceStorm please contact sales@zeroc.com.

    Without event filtering one way to do what you want is to put some piece of metadata in the event context -- such as the sender object id. In the subscriber you then look at the data, and throw out the event if the object-id matches your own object id.
  • I wish I could sponsor it. I'm just a poor college kid though, haha. Sorry guys.

    I knew that I could just do it on the application side, but I wanted to avoid that expensive operation all together. If the publisher and subscriber reside in the same app, is Ice smart enough to not send the data over the network and instead use the loopback or some other means?

    This event filtering functionality will be necessary for the application we're building. Do you see this coming anytime in the near future?

    Thanks,
    Pete
  • matthew
    matthew NL, Canada
    I knew that I could just do it on the application side, but I wanted to avoid that expensive operation all together. If the publisher and subscriber reside in the same app, is Ice smart enough to not send the data over the network and instead use the loopback or some other means?

    Ice does have collocation optimization, by which calls on "local" Ice objects (that is, Ice objects hosted by the same communicator as the proxy used to call on the Ice object) are directly dispatched, instead of first marshaled, sent over the wire, read and dispatched. However, in this case the collocation optimization cannot be applied since you are sending through an another service (in this case, IceStorm).
    This event filtering functionality will be necessary for the application we're building. Do you see this coming anytime in the near future?

    Without a sponsor, event filtering will not be added in the near future.
  • matthew wrote: »
    Without a sponsor, event filtering will not be added in the near future.

    If we decide to use IceStorm for our event channel needs, we will be implementing our own event filtering system to IceStorm. If you'd like to sponsor this and a promising medical project, feel free to contact me at sylvester_peter@dwc.edu.

    Pete
  • Application is a publisher and subscriber to a topic(s)

    Hi ZeroC Staff /Pete,

    I have just started using Ice/IceStorm yesterday and am a total middleware novice. I'm looking to build a working prototype system where by every process is both a publisher and a subscriber, possibly on different topics.

    I am using C# and have tried to get this approach working but am not having much luck.

    both my subscriber and publisher classes make use of the same slice output file and inherit from Ice.Application and reside within the same namespace. Further i 'new' these objects from within their own threads from the application main but Im not getting the results I expect.

    Is there a preferred or known way to organize the classes that inherit from Ice.Application so they can both publish and subscribe, or is there an alternative mechanism/technique that can be used?

    Thanks very much
    Warren
  • xdm
    xdm La Coruña, Spain
    Hi Warren,

    Ice.Application is a convenient class for creating Ice applications, in resume it takes care of initialize Ice runtime when the application start and cleanup it when the application finish, you can get more details of Ice.Application in Ice manual, note that Ice.Application does not affect to your subscriber or publiser roll with IceStorm, being a publisher or a subscriber is only a matter of use the convenient IceStorm mechanism, You should read IceStorm chapter of Ice manual and look IceStorm demos to check the details.

    If after revise these materials you still have problems with use IceStorm, you can ask here your concrete problem and we will happy to help you.

    Note that for use IceStorm you don´t need to use Ice.Application but most of the time you want to use it as it simplified the task of initialize the Ice runtime, but you still could initialize/cleanup the runtime in your code if that is more convenient for your concrete use case.

    Regards,
    José