Hi.
I have some questions regarding the WSN model with the Pull-method of
notifications as opposed to the push-method. I am a newbie, so please bare
with me. I have been reading up all last week so I know some stuff, but not
enough to get started yet. We are looking to go with this model to replace
an existing push model.
- I want to allow a customer to send a message to subscribe to and
unsubscribe from a topic. I then parse the message and get the topic and
endpointReference. If this epr is not in a list of clients, I create a new
object (I call it NotificationClient) that stores a PullPoint and
provides methods for actions like subscribe(topic), unsubscribe(topic),
getMessages(int). Otherwise, I get the client from the list. I am fairly
certain I did this part right so far.
But, I am stuck on a couple of things:
- When I create the client, I use the
SimplePullPointCreation().createPullPoint() method, which does all the
things I need (including subscribing itself to NotificationProducer). But,
it returns an EndpointReference object, not a PullPoint object. Wouldn't it
make more sense to return the PullPoint object (given the method name) and
create a method in the PullPoint class, if one is not already there, to
return the EndpointReference? *The thing I need help with is how to
convert or cast the EndpointReference into a SimplePullPoint object, as I
use the SimplePullPoint object and make calls directly to it.*
- I am unsure of how the PullPoint and subscribing would work with this
scenario, which is common for me:
Say I want to subscribe 2 clients, ClientA and ClientB, and each wants to
subscribe to a different topic. I subscribe ClientA with eprA and ClientB
with erpB. Each creates its own PullPoint (from above) and their PullPoint
is now subscribed to the NotificationProducer. But what is the purpose for
the endpoint references for ClientA and ClientB in the subscribe request if
the subscribing is done by the PullPoint, other than identification for who
is subscribing and using that I to find the PullPoint that was created by
that Client? *And, is the subscribing by the PullPoint not going to be the
same for each time createPullPoint() is called, considering there is no
method input? Or do I have to create a PullPoint another way, and what is
that way?*
Basically, I want a method that will create a PullPoint, subscribe it to the
NotificationProducer for the topics/filter I provide, and get the PullPoint
object in return, which I use later on to get the messages from.
private void createPullPointAndSubscribe() throws Exception
{
SimplePullPointCreation s = new SimplePullPointCreation();
s.initialize();
EndpointReference pullPointEpr = s.createPullPoint();
SimplePullPoint pullPoint = ... //need to cast the pullPointEpr into a
PullPoint object (or do it another way)
if (!pullPoint.hasBeenInitialized())
{
pullPoint.initialize();
}
}
Thanks.
Jeff G.