private void dispatchDirect(Message message) throws IOException { if (destination.getMessageObserver() == null) { throw new IllegalStateException("Local destination does not have a MessageObserver on address " + destination.getAddress().getAddress().getValue()); } MessageImpl copy = new MessageImpl(); copy.put(IN_CONDUIT, this); copy.setDestination(destination); transportFactory.copy(message, copy); MessageImpl.copyContent(message, copy); OutputStream out = message.getContent(OutputStream.class); out.flush(); out.close(); CachedOutputStream stream = message.get(CachedOutputStream.class); copy.setContent(InputStream.class, stream.getInputStream()); copy.removeContent(CachedOutputStream.class); stream.releaseTempFileHold(); // Create a new incoming exchange and store the original exchange for the response ExchangeImpl ex = new ExchangeImpl(); ex.setInMessage(copy); ex.put(IN_EXCHANGE, message.getExchange()); ex.put(LocalConduit.DIRECT_DISPATCH, true); ex.setDestination(destination); destination.getMessageObserver().onMessage(copy); }
private void dispatchDirect(Message message) throws IOException { if (destination.getMessageObserver() == null) { throw new IllegalStateException("Local destination does not have a MessageObserver on address " + destination.getAddress().getAddress().getValue()); } MessageImpl copy = new MessageImpl(); copy.put(IN_CONDUIT, this); copy.setDestination(destination); transportFactory.copy(message, copy); MessageImpl.copyContent(message, copy); OutputStream out = message.getContent(OutputStream.class); out.flush(); out.close(); CachedOutputStream stream = message.get(CachedOutputStream.class); copy.setContent(InputStream.class, stream.getInputStream()); copy.removeContent(CachedOutputStream.class); stream.releaseTempFileHold(); // Create a new incoming exchange and store the original exchange for the response ExchangeImpl ex = new ExchangeImpl(); ex.setInMessage(copy); ex.put(IN_EXCHANGE, message.getExchange()); ex.put(LocalConduit.DIRECT_DISPATCH, true); ex.setDestination(destination); destination.getMessageObserver().onMessage(copy); }