}
// TODO: SubscriptionHome class is specific to WSN 2004/06 - should be replaced by a WSN-version-neutral SubscriptionHome interface
SubscriptionHome subscriptionHome =
(SubscriptionHome) SubscriptionManager.getInstance( ).getSubscriptionManagerHome( m_producerResource );
Subscription subscription = null;
try
{
subscription =
subscriptionHome.create( m_producerResource.getEndpointReference( ),
consumerEPR,
topicExpr );
subscription.setTerminationTime( initialTerminationTime );
subscription.setUseNotify( ( useNotify == null ) || useNotify.booleanValue( ) );
subscription.setSelector( selector );
subscription.setPrecondition( precondition );
subscription.setPolicy( policy );
SubscriptionManager.getInstance( ).addSubscription( subscription, topics );
}
catch ( Exception e )
{
LOG.error( "Subscribe failed due to internal error: " + e );
if ( LOG.isDebugEnabled( ) )
{
e.printStackTrace( );
}
throw new SubscribeCreationFailedException( e );
}
return subscription.getEndpointReference( );
}