use of org.oasis_open.docs.wsn.bw_2.UnableToDestroySubscriptionFault in project cxf by apache.
the class AbstractNotificationBroker method handleSubscribe.
public SubscribeResponse handleSubscribe(Subscribe subscribeRequest, EndpointManager manager) throws // CHECKSTYLE:OFF - WS-Notification spec throws a lot of faults
InvalidFilterFault, InvalidMessageContentExpressionFault, InvalidProducerPropertiesExpressionFault, InvalidTopicExpressionFault, SubscribeCreationFailedFault, TopicExpressionDialectUnknownFault, TopicNotSupportedFault, UnacceptableInitialTerminationTimeFault, UnsupportedPolicyRequestFault, UnrecognizedPolicyRequestFault {
// CHECKSTYLE:ON
AbstractSubscription subscription = null;
boolean success = false;
try {
subscription = createSubscription(idGenerator.generateSanitizedId());
subscription.setBroker(this);
subscriptions.put(subscription.getAddress(), subscription);
subscription.create(subscribeRequest);
if (manager != null) {
subscription.setManager(manager);
}
subscription.register();
SubscribeResponse response = new SubscribeResponse();
response.setSubscriptionReference(subscription.getEpr());
success = true;
return response;
} catch (EndpointRegistrationException e) {
LOGGER.log(Level.WARNING, "Unable to register new endpoint", e);
SubscribeCreationFailedFaultType fault = new SubscribeCreationFailedFaultType();
throw new SubscribeCreationFailedFault("Unable to register new endpoint", fault, e);
} finally {
if (!success && subscription != null) {
if (subscription.getAddress() != null) {
subscriptions.remove(subscription.getAddress());
}
try {
subscription.unsubscribe();
} catch (UnableToDestroySubscriptionFault e) {
LOGGER.log(Level.INFO, "Error destroying subscription", e);
}
}
}
}
use of org.oasis_open.docs.wsn.bw_2.UnableToDestroySubscriptionFault in project cxf by apache.
the class JmsSubscription method unsubscribe.
@Override
protected void unsubscribe() throws UnableToDestroySubscriptionFault {
super.unsubscribe();
if (session != null) {
try {
session.close();
checkTermination = false;
} catch (JMSException e) {
UnableToDestroySubscriptionFaultType fault = new UnableToDestroySubscriptionFaultType();
throw new UnableToDestroySubscriptionFault("Unable to unsubscribe", fault, e);
} finally {
session = null;
}
}
}
Aggregations