use of org.apache.cxf.transport.MultiplexDestination in project cxf by apache.
the class EndpointReferenceUtils method getEndpointReferenceWithId.
/**
* Obtain a multiplexed endpoint reference for the deployed service that contains the provided id
* @param serviceQName identified the target service
* @param portName identifies a particular port of the service, may be null
* @param id that must be embedded in the returned reference
* @param bus the current bus
* @return a new reference or null if the target destination does not support destination mutiplexing
*/
public static EndpointReferenceType getEndpointReferenceWithId(QName serviceQName, String portName, String id, Bus bus) {
EndpointReferenceType epr = null;
MultiplexDestination destination = getMatchingMultiplexDestination(serviceQName, portName, bus);
if (null != destination) {
epr = destination.getAddressWithId(id);
}
return epr;
}
use of org.apache.cxf.transport.MultiplexDestination in project cxf by apache.
the class EndpointReferenceUtils method getMatchingMultiplexDestination.
private static MultiplexDestination getMatchingMultiplexDestination(QName serviceQName, String portName, Bus bus) {
MultiplexDestination destination = null;
ServerRegistry serverRegistry = bus.getExtension(ServerRegistry.class);
if (null != serverRegistry) {
List<Server> servers = serverRegistry.getServers();
for (Server s : servers) {
QName targetServiceQName = s.getEndpoint().getEndpointInfo().getService().getName();
if (serviceQName.equals(targetServiceQName) && portNameMatches(s, portName)) {
Destination dest = s.getDestination();
if (dest instanceof MultiplexDestination) {
destination = (MultiplexDestination) dest;
break;
}
}
}
} else {
LOG.log(Level.WARNING, "Failed to locate service matching " + serviceQName + ", because the bus ServerRegistry extension provider is null");
}
return destination;
}
use of org.apache.cxf.transport.MultiplexDestination in project cxf by apache.
the class JMSDestinationTest method testIsMultiplexCapable.
@Test
public void testIsMultiplexCapable() throws Exception {
EndpointInfo ei = setupServiceInfo("HelloWorldService", "HelloWorldPort");
final JMSDestination destination = setupJMSDestination(ei);
destination.setMessageObserver(createMessageObserver());
assertTrue("is multiplex", destination instanceof MultiplexDestination);
destination.shutdown();
}
use of org.apache.cxf.transport.MultiplexDestination in project cxf by apache.
the class EndpointReferenceUtils method getEndpointReferenceId.
/**
* Obtain the id String from the endpoint reference of the current dispatch.
* @param messageContext the current message context
* @return the id embedded in the current endpoint reference or null if not found
*/
public static String getEndpointReferenceId(Map<String, Object> messageContext) {
String id = null;
Destination destination = (Destination) messageContext.get(Destination.class.getName());
if (destination instanceof MultiplexDestination) {
id = ((MultiplexDestination) destination).getId(messageContext);
}
return id;
}
Aggregations