@Override public void handleFault(Exchange exchange) { _isFault = true; _response = exchange.getMessage(); } }
@Override public void handleFault(Exchange exchange) { _isFault = true; _response = exchange.getMessage(); } }
@Override public Message getMessage() { return isNew() ? _inMessage : _exchange.getMessage(); }
@Override public void handleFault(Exchange exchange) { _fault = exchange.getMessage().getContent(); super.handleFault(exchange); } }
@Override public void handleFault(Exchange exchange) { _fault = exchange.getMessage().getContent(); super.handleFault(exchange); } }
@Override public void handleMessage(Exchange exchange) throws HandlerException { String content = (String) exchange.getMessage().getContent(); if (content.equals("Hello there, SwitchYard")) { success=true; } } }
public void handleMessage(Exchange exchange) { Assert.assertEquals( exchange.getMessage().getContent(), outMsgContent); } };
@Override public JMSBindingData decompose(Exchange exchange, JMSBindingData target) throws Exception { exchange.getMessage().setContent(exchange.getMessage().getContent(String.class)+"test"); return super.decompose(exchange, target); }
@Override public void after(String target, Exchange exchange) throws HandlerException { // We only want to intercept successful replies from OrderService if (exchange.getProvider().getName().getLocalPart().equals("OrderService") && ExchangeState.OK.equals(exchange.getState())) { OrderAck orderAck = exchange.getMessage().getContent(OrderAck.class); orderAck.setStatus(orderAck.getStatus() + " [intercepted]"); } }
@Override public void after(String target, Exchange exchange) throws HandlerException { // We only want to intercept successful replies from OrderService if (exchange.getProvider().getName().getLocalPart().equals("OrderService") && ExchangeState.OK.equals(exchange.getState())) { OrderAck orderAck = exchange.getMessage().getContent(OrderAck.class); orderAck.setStatus(orderAck.getStatus() + " [intercepted]"); } }
/** * {@inheritDoc} */ @Override public HttpBindingData decompose(Exchange exchange, HttpBindingData target) throws Exception { Object content = exchange.getMessage().getContent(); if ((content instanceof String) && (content.equals(""))) { exchange.getContext().setProperty(HttpContextMapper.HTTP_RESPONSE_STATUS, 404).addLabels(new String[]{EndpointLabel.HTTP.label()}); } target = super.decompose(exchange, target); return target; }
/** * {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public MappedRecordBindingData decompose(Exchange exchange, MappedRecordBindingData target) throws Exception { Message sourceMessage = exchange.getMessage(); getContextMapper().mapTo(exchange.getContext(), target); final Map<?,?> content = sourceMessage.getContent(Map.class); target.getRecord().putAll(content); return target; }
/** * {@inheritDoc} */ @Override public StreamableRecordBindingData decompose(Exchange exchange, StreamableRecordBindingData target) throws Exception { Message sourceMessage = exchange.getMessage(); getContextMapper().mapTo(exchange.getContext(), target); final InputStream content = sourceMessage.getContent(InputStream.class); target.getRecord().read(content); return target; }
/** * {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public IndexedRecordBindingData decompose(Exchange exchange, IndexedRecordBindingData target) throws Exception { Message sourceMessage = exchange.getMessage(); getContextMapper().mapTo(exchange.getContext(), target); final List<?> content = sourceMessage.getContent(List.class); target.getRecord().addAll(content); return target; }
@Override public void handleMessage(final Exchange exchange) throws HandlerException { _messages.offer(exchange); if (_forwardInToOut) { exchange.send(exchange.getMessage().copy()); } else if (_forwardInToFault) { exchange.sendFault(exchange.createMessage()); } }
private void initInTransformSequence(Exchange exchange) { QName exchangeInputType = exchange.getContract().getConsumerOperation().getInputType(); QName serviceOperationInputType = exchange.getContract().getProviderOperation().getInputType(); if (exchangeInputType != null && serviceOperationInputType != null) { TransformSequence. from(exchangeInputType). to(serviceOperationInputType). associateWith(exchange.getMessage()); } }
private void initInTransformSequence(Exchange exchange) { QName exchangeInputType = exchange.getContract().getConsumerOperation().getInputType(); QName serviceOperationInputType = exchange.getContract().getProviderOperation().getInputType(); if (exchangeInputType != null && serviceOperationInputType != null) { TransformSequence. from(exchangeInputType). to(serviceOperationInputType). associateWith(exchange.getMessage()); } }
private void initOutTransformSequence(Exchange exchange) { QName serviceOperationOutputType = exchange.getContract().getProviderOperation().getOutputType(); QName exchangeOutputType = exchange.getContract().getConsumerOperation().getOutputType(); if (serviceOperationOutputType != null && exchangeOutputType != null) { TransformSequence. from(serviceOperationOutputType). to(exchangeOutputType). associateWith(exchange.getMessage()); } }
private void initOutTransformSequence(Exchange exchange) { QName serviceOperationOutputType = exchange.getContract().getProviderOperation().getOutputType(); QName exchangeOutputType = exchange.getContract().getConsumerOperation().getOutputType(); if (serviceOperationOutputType != null && exchangeOutputType != null) { TransformSequence. from(serviceOperationOutputType). to(exchangeOutputType). associateWith(exchange.getMessage()); } }
@Test public void testMessageIdSetOnSend() { ServiceReference service = _domain.createInOnlyService(new QName("IdTest")); Exchange exchange = service.createExchange(); exchange.send(exchange.createMessage()); Assert.assertNotNull(exchange.getMessage().getContext().getProperty(Exchange.MESSAGE_ID)); }