protected void setAsyncMessageObserverIfNeeded(Exchange exchange) { if (!exchange.isSynchronous()) { ExecutorService executor = (ExecutorService)cfg.getRequestContext().get(EXECUTOR_SERVICE_PROPERTY); if (executor != null) { exchange.put(Executor.class, executor); final ClientMessageObserver observer = new ClientMessageObserver(cfg); exchange.put(MessageObserver.class, message -> { if (!message.getExchange().containsKey(Executor.class.getName() + ".USING_SPECIFIED")) { executor.execute(() -> { observer.onMessage(message); }); } else { observer.onMessage(message); } }); } } }
/** * Gets the conduit responsible for a transport-level * communication with the remote service. * @return the conduit */ public Conduit getConduit() { Message message = new MessageImpl(); Exchange exchange = new ExchangeImpl(); message.setExchange(exchange); exchange.put(MessageObserver.class, new ClientMessageObserver(this)); if (conduitSelector != null) { exchange.put(Endpoint.class, conduitSelector.getEndpoint()); } exchange.put(Bus.class, bus); prepareConduitSelector(message); return getConduitSelector().selectConduit(message); }
/** * Gets the conduit responsible for a transport-level * communication with the remote service. * @return the conduit */ public Conduit getConduit() { Message message = new MessageImpl(); Exchange exchange = new ExchangeImpl(); message.setExchange(exchange); exchange.put(MessageObserver.class, new ClientMessageObserver(this)); if (conduitSelector != null) { exchange.put(Endpoint.class, conduitSelector.getEndpoint()); } exchange.put(Bus.class, bus); prepareConduitSelector(message); return getConduitSelector().selectConduit(message); }
protected Exchange createExchange(Message m, Exchange exchange) { if (exchange == null) { exchange = new ExchangeImpl(); } exchange.setSynchronous(true); exchange.setOutMessage(m); exchange.put(Bus.class, cfg.getBus()); exchange.put(MessageObserver.class, new ClientMessageObserver(cfg)); exchange.put(Endpoint.class, cfg.getConduitSelector().getEndpoint()); exchange.put("org.apache.cxf.transport.no_io_exceptions", true); //REVISIT - when response handling is actually put onto the in chain, this will likely not be needed exchange.put(StaxInEndingInterceptor.STAX_IN_NOCLOSE, Boolean.TRUE); m.setExchange(exchange); return exchange; }
protected void setAsyncMessageObserverIfNeeded(Exchange exchange) { if (!exchange.isSynchronous()) { ExecutorService executor = (ExecutorService)cfg.getRequestContext().get(EXECUTOR_SERVICE_PROPERTY); if (executor != null) { exchange.put(Executor.class, executor); final ClientMessageObserver observer = new ClientMessageObserver(cfg); exchange.put(MessageObserver.class, message -> { if (!message.getExchange().containsKey(Executor.class.getName() + ".USING_SPECIFIED")) { executor.execute(() -> { observer.onMessage(message); }); } else { observer.onMessage(message); } }); } } }
/** * Gets the conduit responsible for a transport-level * communication with the remote service. * @return the conduit */ public Conduit getConduit() { Message message = new MessageImpl(); Exchange exchange = new ExchangeImpl(); message.setExchange(exchange); exchange.put(MessageObserver.class, new ClientMessageObserver(this)); if (conduitSelector != null) { exchange.put(Endpoint.class, conduitSelector.getEndpoint()); } exchange.put(Bus.class, bus); prepareConduitSelector(message); return getConduitSelector().selectConduit(message); }
protected Exchange createExchange(Message m, Exchange exchange) { if (exchange == null) { exchange = new ExchangeImpl(); } exchange.setSynchronous(true); exchange.setOutMessage(m); exchange.put(Bus.class, cfg.getBus()); exchange.put(MessageObserver.class, new ClientMessageObserver(cfg)); exchange.put(Endpoint.class, cfg.getConduitSelector().getEndpoint()); exchange.put("org.apache.cxf.transport.no_io_exceptions", true); //REVISIT - when response handling is actually put onto the in chain, this will likely not be needed exchange.put(StaxInEndingInterceptor.STAX_IN_NOCLOSE, Boolean.TRUE); m.setExchange(exchange); return exchange; }
protected Exchange createExchange(Message m, Exchange exchange) { if (exchange == null) { exchange = new ExchangeImpl(); } exchange.setSynchronous(true); exchange.setOutMessage(m); exchange.put(Bus.class, cfg.getBus()); exchange.put(MessageObserver.class, new ClientMessageObserver(cfg)); exchange.put(Endpoint.class, cfg.getConduitSelector().getEndpoint()); exchange.put("org.apache.cxf.transport.no_io_exceptions", true); //REVISIT - when response handling is actually put onto the in chain, this will likely not be needed exchange.put(StaxInEndingInterceptor.STAX_IN_NOCLOSE, Boolean.TRUE); m.setExchange(exchange); return exchange; }