There's no way to do this with the current public API
(NotificationProducer interface). However, you could implement it
(immediately) by subclassing SimpleNotificationProducer and using its
protected methods; the code below should do what you want:
//
// tests if a given consumer has one or more subscriptions
// with the producer resource
//
public boolean hasConsumer(EndpointReference consumerEPR)
{
Iterator i = getSubscriptions().iterator();
while (i.hasNext())
{
WsResource subResource = (WsResource)i.next();
SubscriptionManager subCap =
subResource.getCapability(WsnConstants.SUBSCRIPTION_MGR_URI);
if (consumerEPR.equals(subCap.getConsumerReference())
return true;
}
return false;
}
"Vinh Nguyen \(vinguye2\)" <[EMAIL PROTECTED]> wrote on 03/23/2007
06:48:10 PM:
> Is there a way to check if a consumer EPR is already subscribed for
> notifications on a particular resource?
> The SimpleNotificationProducer has a subscribe() method, but there is no
> corresponding isSubscribed(EPR) method.
>
> I have a resource operation that takes in a consumer EPR and some other
> parameters. It will be possible that my operation is called multiple
> times with the same consumer EPR. So, in my operation, I want to make
> sure that if the consumer is already subscribed, that I don't try to
> call the subscribe(EPR) method again. Otherwise, it will unnecessarily
> create a new SubscriptionManager instance.
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]