/**
* Extracts the subscriber endpoint from the subscription request using the
* serviceName or the portType
*/
protected ServiceEndpoint findSubscriberEndpoint(ActiveMQSubscription subscribe) {
EndpointReferenceType consumerReference = subscribe.getConsumerReference();
if (consumerReference == null) {
throw new NotificationException("No consumerReference specified for subscription: " + subscribe);
}
ServiceNameType serviceNameType = consumerReference.getServiceName();
if (serviceNameType == null) {
log.warn("No service name available for subscription: " + subscribe);
}
else {
QName serviceName = serviceNameType.getValue();
ServiceEndpoint[] endpoints = context.getEndpointsForService(serviceName);
if (endpoints != null && endpoints.length > 0) {
// lets just return the first
return endpoints[0];
}
}
AttributedQName portTypeType = consumerReference.getPortType();
if (portTypeType != null) {
QName portType = portTypeType.getValue();
ServiceEndpoint[] endpoints = context.getEndpoints(portType);
if (endpoints != null && endpoints.length > 0) {
// lets just return the first