List of usage examples for org.springframework.messaging Message getPayload
T getPayload();
From source file:apiserver.services.cache.services.DocumentService.java
public Message<?> addToCache(Message<?> message) { if (!(message.getPayload() instanceof DocumentJob)) { return message; }/*from w w w . j a v a2 s .c o m*/ DocumentJob payload = (DocumentJob) message.getPayload(); if (payload.getDocument() != null) { IDocument document = cacheProvider.add(payload.getDocument()); payload.setDocument(document); } return message; }
From source file:org.thingsplode.server.bus.executors.AbstractSyncExecutor.java
public void process(Message<?> msg) { AbstractRequest req = (AbstractRequest) msg.getPayload(); Device callerDevice = getDeviceRepo().findByIdentification(req.getDeviceId()); if (callerDevice == null) { throw new IllegalStateException(String.format("The device identified by id [%s] is not registered", req.getDeviceId() != null ? req.getDeviceId() : "<NULL>")); }/* w w w.jav a 2 s . co m*/ try { executeImpl((REQ) msg.getPayload(), msg.getHeaders(), callerDevice); } catch (SrvExecutionException ex) { logger.error(ex.getMessage(), ex); getMsgTemplate().send(MessageBuilder .withPayload(new ErrorMessage(ex.getExecutionStatus(), ex.getResponseCode(), ex)).build()); } catch (Exception ex) { logger.error(ex.getMessage(), ex); getMsgTemplate().send(MessageBuilder .withPayload(new ErrorMessage(ExecutionStatus.DECLINED, determineResponseCode(ex), ex)) .build()); } }
From source file:biz.c24.io.spring.integration.selector.AbstractXPathMessageSelector.java
final public boolean accept(Message<?> message) { Object payload = message.getPayload(); ComplexDataObject cdo;/*from w ww . j a va 2s . co m*/ try { cdo = (ComplexDataObject) payload; } catch (ClassCastException e) { throw new MessagingException("Cannot evaluate payload of type [" + payload.getClass().getName() + "]. Only ComplexDataObject is supported.", e); } try { return doAcceptPayload(cdo); } catch (IOXPathException e) { throw new XPathException("Exception thrown trying to evaluate [" + statement + "]", e); } }
From source file:biz.c24.io.spring.integration.config.UnmarshalITests.java
@Test public void canUnmarshal() throws Exception { template.convertAndSend(loadCsvBytes()); Message<?> message = cdoChannel.receive(1); assertThat(message.getPayload(), notNullValue()); assertThat(message.getPayload(), is(Employees.class)); }
From source file:org.openwms.common.comm.router.CommonMessageRouter.java
/** * Routing method, tries to map an incoming {@link Payload} to a MessageChannel. * //from w w w . j a v a2 s . co m * @param message * The message to process * @return The MessageChannel where to put the message */ @Router(inputChannel = "transformerOutputChannel", defaultOutputChannel = "commonExceptionChannel") public MessageChannel resolve(Message<Payload> message) { return processorMap.get(message.getPayload().getMessageIdentifier() + CommConstants.CHANNEL_SUFFIX) .getChannel(); }
From source file:com.consol.citrus.samples.bookstore.exceptions.DuplicateIsbnException.java
/** * @param failedMessage/*ww w .j a v a 2 s.c o m*/ */ public DuplicateIsbnException(Message<AddBookRequestMessage> failedMessage) { super(failedMessage, "Duplicate ISBN '" + failedMessage.getPayload().getBook().getIsbn() + "'! Book already exists in registry!"); }
From source file:biz.c24.io.spring.integration.config.HeaderEnricherTests.java
@Test public void canEnrich() throws Exception { template.convertAndSend(loadCsvBytes()); Message<?> message = rightChannel.receive(1); assertThat(message.getPayload(), notNullValue()); assertThat(message.getHeaders().get("bar", String.class), is("Acheson")); assertThat(message.getHeaders().get("foo", String.class), is("Andy")); }
From source file:com.samples.platform.core.SamplesMessageContentProvider.java
/** * @see com.qpark.eip.core.spring.statistics.MessageContentProvider#getUserName(org.springframework.messaging.Message) *//*from w w w. j a v a2 s . co m*/ @Override public String getUserName(final Message<?> message) { Object payload = message.getPayload(); if (JAXBElement.class.isInstance(payload)) { payload = ((JAXBElement<?>) payload).getValue(); } return this.getUserName(payload); }
From source file:biz.c24.io.spring.integration.config.XPathRouterMappingTests.java
@Test public void canUnmarshal() throws Exception { template.convertAndSend(loadCsvBytes()); Message<?> message = rightChannel.receive(1); assertThat(message.getPayload(), notNullValue()); assertThat(message.getPayload(), is(Employees.class)); }
From source file:com.codeveo.lago.bot.stomp.client.LagoStompMessageHandler.java
@Override public void handleError(Message<byte[]> message) { LOG.error("Error occured: '{}'", message.getPayload()); }