use of org.apache.cxf.BusFactory in project cxf by apache.
the class BusServer method run.
protected void run() {
//
// Just instantiate the Bus; services will be instantiated
// and published automatically through Spring
//
final BusFactory factory = BusFactory.newInstance();
Bus bus = factory.createBus();
setBus(bus);
BusFactory.setDefaultBus(bus);
BusFactory.setThreadDefaultBus(bus);
}
use of org.apache.cxf.BusFactory in project cxf by apache.
the class BusServer method run.
protected void run() {
//
// Just instantiate the Bus; services will be instantiated
// and published automatically through Spring
//
final BusFactory factory = BusFactory.newInstance();
Bus bus = factory.createBus();
setBus(bus);
BusFactory.setDefaultBus(bus);
BusFactory.setThreadDefaultBus(bus);
}
use of org.apache.cxf.BusFactory in project cxf by apache.
the class JCABusFactory method init.
protected synchronized void init() throws ResourceException {
LOG.info("Initializing the CXF Bus ...");
new UriHandlerInit();
ClassLoader original = Thread.currentThread().getContextClassLoader();
try {
ClassLoader cl = this.getClass().getClassLoader();
// ensure resourceadapter: url handler can be found by URLFactory
Thread.currentThread().setContextClassLoader(cl);
// TODO Check for the managed connection factory properties
// TODO We may need get the configuration file from properties
BusFactory bf = BusFactory.newInstance();
bus = bf.createBus();
initializeServants();
} catch (Exception ex) {
if (ex instanceof ResourceAdapterInternalException) {
throw (ResourceException) ex;
}
throw new ResourceAdapterInternalException(new Message("FAIL_TO_INITIALIZE_JCABUSFACTORY", BUNDLE).toString(), ex);
} finally {
Thread.currentThread().setContextClassLoader(original);
}
}
use of org.apache.cxf.BusFactory in project cxf by apache.
the class MessageIdAsCorrelationIdJMSConduitTest method sendAndReceive.
public void sendAndReceive(boolean synchronous, String replyDestination) throws Exception {
BusFactory bf = BusFactory.newInstance();
Bus bus = bf.createBus();
BusFactory.setDefaultBus(bus);
EndpointReferenceType target = new EndpointReferenceType();
connectionFactory = new PooledConnectionFactory(BROKER_URI);
TestReceiver receiver = new TestReceiver(connectionFactory, SERVICE_QUEUE, true);
receiver.runAsync();
JMSConfiguration jmsConfig = new JMSConfiguration();
jmsConfig.setTargetDestination(SERVICE_QUEUE);
jmsConfig.setConnectionFactory(connectionFactory);
jmsConfig.setUseConduitIdSelector(false);
jmsConfig.setReplyDestination(replyDestination);
JMSConduit conduit = new JMSConduit(target, jmsConfig, bus);
Exchange exchange = new ExchangeImpl();
exchange.setSynchronous(synchronous);
Message message = new MessageImpl();
exchange.setOutMessage(message);
conduit.sendExchange(exchange, "Request");
waitForAsyncReply(exchange);
receiver.close();
if (exchange.getInMessage() == null) {
throw new RuntimeException("No reply received within 2 seconds");
}
JMSMessageHeadersType inHeaders = (JMSMessageHeadersType) exchange.getInMessage().get(JMSConstants.JMS_CLIENT_RESPONSE_HEADERS);
Assert.assertEquals(receiver.getRequestMessageId(), inHeaders.getJMSCorrelationID());
conduit.close();
bus.shutdown(true);
}
use of org.apache.cxf.BusFactory in project jbossws-cxf by jbossws.
the class Helper method verifyCXF.
public static void verifyCXF() {
// check BusFactory customization; this is required by the JBWS-CXF Configurer integration (HTTPConduit customization, JAXBIntros, ...)
BusFactory factory = BusFactory.newInstance();
if (!(factory instanceof JBossWSBusFactory))
throw new RuntimeException("Expected " + JBossWSBusFactory.class + " but got " + (factory == null ? null : factory.getClass()));
// check the Apache CXF JAXWS implementation is actually used
Object obj = getImplementationObject();
if (!obj.getClass().getName().contains("cxf"))
throw new RuntimeException("JAXWS implementation is not properly selected or endorsed!");
}
Aggregations