use of org.apache.cxf.transport.Conduit in project fabric8 by jboss-fuse.
the class LoadBalanceTargetSelector method getNextConduit.
protected Conduit getNextConduit(Message message) {
Conduit answer = null;
Exchange exchange = message.getExchange();
EndpointInfo ei = endpoint.getEndpointInfo();
String address = loadBalanceStrategy.getNextAlternateAddress();
if (overrideAddress(message)) {
// We need to override the Endpoint Address here
message.put(Message.ENDPOINT_ADDRESS, address);
}
try {
ConduitInitiatorManager conduitInitiatorMgr = exchange.getBus().getExtension(ConduitInitiatorManager.class);
if (conduitInitiatorMgr != null) {
ConduitInitiator conduitInitiator = conduitInitiatorMgr.getConduitInitiatorForUri(address);
if (conduitInitiator != null) {
EndpointReferenceType epr = new EndpointReferenceType();
AttributedURIType ad = new AttributedURIType();
ad.setValue(address);
epr.setAddress(ad);
answer = conduitInitiator.getConduit(ei, epr, exchange.getBus());
MessageObserver observer = exchange.get(MessageObserver.class);
if (observer != null) {
answer.setMessageObserver(observer);
} else {
getLogger().warning("MessageObserver not found");
}
} else {
getLogger().warning("ConduitInitiator not found: " + ei.getAddress());
}
} else {
getLogger().warning("ConduitInitiatorManager not found");
}
} catch (IOException ex) {
throw new Fault(ex);
}
return answer;
}
use of org.apache.cxf.transport.Conduit in project tesb-rt-se by Talend.
the class JmsConfiguratorTest method createAndConfigureDispatchAddressing.
@Test
public void createAndConfigureDispatchAddressing() {
Service service = Service.create(SERVICE_NAME);
service.addPort(PORT_NAME, SOAPBinding.SOAP11HTTP_BINDING, "jms://");
Dispatch<Source> dispatch = service.createDispatch(PORT_NAME, Source.class, Service.Mode.PAYLOAD);
Assert.assertNotNull(dispatch);
JmsConfigurator jmsConfigurator = JmsConfigurator.create(dispatch);
Assert.assertNotNull(jmsConfigurator);
Assert.assertEquals("SoapPort", jmsConfigurator.getConfigurationPrefix());
Assert.assertEquals(SERVICE_NAME, jmsConfigurator.getServiceName());
Dispatch<Source> dispatch2 = jmsConfigurator.configureDispatch(dispatch, "jms://");
Assert.assertNotNull(dispatch2);
Conduit conduit = ((DispatchImpl) dispatch2).getClient().getConduit();
Assert.assertNotNull(conduit);
Assert.assertTrue(conduit instanceof JMSConduit);
JMSConduit jmsConduit = (JMSConduit) conduit;
JMSConfiguration jmsConfiguration = jmsConduit.getJmsConfig();
Assert.assertNotNull(jmsConfiguration);
}
use of org.apache.cxf.transport.Conduit in project tesb-rt-se by Talend.
the class JmsConfiguratorTest method createAndConfigureDispatch.
@Test
public void createAndConfigureDispatch() {
Service service = Service.create(SERVICE_NAME);
service.addPort(PORT_NAME, SOAPBinding.SOAP11HTTP_BINDING, "jms://");
Dispatch<Source> dispatch = service.createDispatch(PORT_NAME, Source.class, Service.Mode.PAYLOAD);
Assert.assertNotNull(dispatch);
JmsConfigurator jmsConfigurator = JmsConfigurator.create(dispatch);
Assert.assertNotNull(jmsConfigurator);
Assert.assertEquals("SoapPort", jmsConfigurator.getConfigurationPrefix());
Assert.assertEquals(SERVICE_NAME, jmsConfigurator.getServiceName());
Dispatch<Source> dispatch2 = jmsConfigurator.configureDispatch(dispatch);
Assert.assertNotNull(dispatch2);
Conduit conduit = ((DispatchImpl) dispatch2).getClient().getConduit();
Assert.assertNotNull(conduit);
Assert.assertTrue(conduit instanceof JMSConduit);
JMSConduit jmsConduit = (JMSConduit) conduit;
JMSConfiguration jmsConfiguration = jmsConduit.getJmsConfig();
Assert.assertNotNull(jmsConfiguration);
}
use of org.apache.cxf.transport.Conduit in project tesb-rt-se by Talend.
the class DurableSubscriptionFeature method initialize.
@Override
public void initialize(Client client, Bus bus) {
Conduit conduit = client.getConduit();
if (conduit instanceof JMSConduit) {
JMSConfiguration jmsConfig = ((JMSConduit) conduit).getJmsConfig();
updateJMSConfig(jmsConfig);
}
}
use of org.apache.cxf.transport.Conduit in project jbossws-cxf by jbossws.
the class SOAPConnectionImpl method get.
@Override
public SOAPMessage get(Object addressObject) throws SOAPException {
checkClosed();
String address = getAddress(addressObject);
ConduitInitiator ci = getConduitInitiator(address);
// create a new Message and Exchange
EndpointInfo info = new EndpointInfo();
info.setAddress(address);
Message outMessage = new MessageImpl();
Exchange exch = new ExchangeImpl();
outMessage.setExchange(exch);
// sent GET request
try {
// TODO verify bus
final Conduit c = ci.getConduit(info, BusFactory.getThreadDefaultBus(false));
if (c instanceof HTTPConduit) {
((HTTPConduit) c).getClient().setAutoRedirect(true);
}
outMessage.put(Message.HTTP_REQUEST_METHOD, "GET");
c.prepare(outMessage);
c.setMessageObserver(createMessageObserver(c));
c.close(outMessage);
} catch (Exception ex) {
throw MESSAGES.getRequestCouldNotBeSent(ex);
}
// read SOAPMessage
return readSoapMessage(exch);
}
Aggregations