Initialize a SubscriptionService before sending data.

RCF support and general discussion.
Post Reply
falk
Posts: 9
Joined: Fri Mar 30, 2012 2:31 pm

Initialize a SubscriptionService before sending data.

Post by falk »

Is it possible to remotely initialize a service subscriber while conneting before it get service data through the publishing service?
In RCF there is the possibility to install a setOnConnectCallback function in the publisher. The callback knows the RCF Session object. Now this object is converted via convertRcfSessionToRcfClient to get a client object back to the subscriber. With the ClientTransportAutoPtr Parameter the RCFClient object is created with the interface of the Subscriber. Now the subscriber should be initialized with certain calls to this interface.

But as soon as the convertRcfSessionToRcfClient is called, the subscriber will never be called by the publisher service. It seems that the beginSubscribe call in the subscriber has never happened. Without the convert-call everthing goes well.
Now i do not know if this is even possible. There are only code examples for convertRcfSessionToRcfClient in scenarios with classic Rcf clients and servers, not with publisher/subsriber.

I hope the question is clear enough. Otherwise i can provide an example code to illustrate the question a little bit more.

Kind regards
Falk

jarl
Posts: 238
Joined: Mon Oct 03, 2011 4:53 am
Contact:

Re: Initialize a SubscriptionService before sending data.

Post by jarl »

As you've guessed, you can only create callback connections on regular client connections, not pub/sub connections... You can however have your subscriber create a second connection, which the publishing server can use for callbacks.
Kind Regards

Jarl Lindrud
Delta V Software
http://www.deltavsoft.com

falk
Posts: 9
Joined: Fri Mar 30, 2012 2:31 pm

Re: Initialize a SubscriptionService before sending data.

Post by falk »

Ok, late, but here is an answer post :)
Thanks for your answer jarl. Here is it how it is implemented now in case someone is interested in.

Now on the client side there is one RcfServer which serves the following purposes:
  • It should listen for UDP Broadcasts if a service is somewhere available where subscribers can get data from.
  • It get a subscription service added. The beginSubscribe happens later on when an object wants to consume the service data.
  • When a service is available and beginSubscribe was called the RcfServer binds a subscriber wrapper to the service interface defined in Rcf IDL. This happens because the interface also defines a method to signal that the subscriber is initialized.
Because of the last point we can realize a stateful service subscriber which consumes data not until it got its right inner state. An RcfClient is created which calls the server (who hosts the service publisher) that the subscriber wants to be initialized.
This RcfClient is converted to a session (RCF::convertRcfClientToRcfSession) and waits. The subscriber wrapper throws away any service data as long as the converted Client was not signaled that it was initialized. So we have a synchronization between receiving service data and initialization from the service server.

Hope the explanation was clear enough :).

jarl
Posts: 238
Joined: Mon Oct 03, 2011 4:53 am
Contact:

Re: Initialize a SubscriptionService before sending data.

Post by jarl »

Thanks for the explanation :) Glad you got it working.
Kind Regards

Jarl Lindrud
Delta V Software
http://www.deltavsoft.com

Post Reply