public Message<T> build() { if (!this.modified && this.originalMessage != null) { return this.originalMessage; } return new GenericMessage<T>(this.payload, this.headers); }
public Message<T> build() { if (!this.modified && this.originalMessage != null) { return this.originalMessage; } return new GenericMessage<T>(this.payload, this.headers); } }
public Message<?> aggregateMessages(List<Message<?>> messages) { if (CollectionUtils.isEmpty(messages)) { return null; } Object returnedValue = this.methodInvoker.executeMethod(messages); if (returnedValue == null) { return null; } if (returnedValue instanceof Message) { return (Message<?>) returnedValue; } return new GenericMessage<Object>(returnedValue); }
/** * Hint method used to indicate that a message has finished, meaning the previously * written bytes (if any) can be assembled. */ void endMessage() { if (!buffer.isEmpty()) { byte[] raw = new byte[buffer.size()]; for (int i = 0; i < raw.length; i++) { raw[i] = buffer.get(i).byteValue(); } buffer.clear(); handler.handleMessage(new GenericMessage<byte[]>(raw)); } }
public void update(EventBean[] eventBeans, EventBean[] eventBeans1) { LOG.debug("Inbound channel adapter receiving an event from esper"); Assert.notNull(channel); GenericMessage<EventBean[]> message = new GenericMessage<EventBean[]>(eventBeans); if (timeout != null) { if (LOG.isDebugEnabled()) { LOG.debug("Sending message (" + message + ") to channel " + channel + " with timeout " + timeout); } channel.send(message, timeout); } else { if (LOG.isDebugEnabled()) { LOG.debug("Sending message (" + message + ") to channel " + channel); } channel.send(message); } LOG.debug("Inbound channel adapter received an event from esper"); }
public void update(EventBean eventBean) { LOG.debug("Inbound channel adapter receiving an unmatched listener event from esper"); Assert.notNull(channel); GenericMessage<EventBean> message = new GenericMessage<EventBean>(eventBean); if (timeout != null) { if (LOG.isDebugEnabled()) { LOG.debug("Sending message (" + message + ") to channel " + channel + " with timeout " + timeout); } channel.send(message, timeout); } else { if (LOG.isDebugEnabled()) { LOG.debug("Sending message (" + message + ") to channel " + channel); } channel.send(message); } LOG.debug("Inbound channel adapter received an unmatched listener event from esper"); }
@Override public boolean publish(String topic, Event event) { PublishSubscribeChannel intChannel = getChannel(topic); GenericMessage<Object> intMessage = new GenericMessage<Object>(event); intChannel.send(intMessage); return true; }
headers.put(MessageHeaders.ERROR_CHANNEL, this.errorChannel); headers.put(MessageRegistryConstants.MSG_HEADER_SEQ_IDX, currentSeq); Message<T> message = new GenericMessage<T>(payload, headers); data.msgMap.put(msgId, new MessageEntry(currentSeq));
ProcessInterruptingOrchestrationPayload interruptingPayload = new ProcessInterruptingOrchestrationPayload( processData.context); return new GenericMessage<GenericProcessOrchestrationPayload>(interruptingPayload, headers); } else {
ProcessFinishingOrchestrationPayload finishingPayload = new ProcessFinishingOrchestrationPayload( processData.context); return new GenericMessage<GenericProcessOrchestrationPayload>(finishingPayload, headers); } else {
@Override public Message<GenericProcessOrchestrationPayload> initialize( ProcessContext ctx, int size) throws MessageRegistryException { registryLock.writeLock().lock(); try { if (registry.containsKey(ctx.getProcessId())) { // process already started return null; } else { ProcessDataHolder dataHolder = new ProcessDataHolder(ctx); String generatedOrchMsgId = ctx.getProcessId() + '_' + OrchestrationMessageType.PROCESS_STARTING; dataHolder.initMsg = new InitializationMessageTuple( generatedOrchMsgId, size); registry.put(ctx.getProcessId(), dataHolder); // generating message Map<String, Object> headers = new HashMap<String, Object>(); headers.put(MessageRegistryConstants.MSG_HEADER_ID, generatedOrchMsgId); headers.put(MessageRegistryConstants.MSG_HEADER_CTX, ctx); headers.put(MessageHeaders.ERROR_CHANNEL, this.errorChannel); ProcessStartingOrchestrationPayload startingPayload = new ProcessStartingOrchestrationPayload( ctx, size); return new GenericMessage<GenericProcessOrchestrationPayload>(startingPayload, headers); } } finally { registryLock.writeLock().unlock(); } }
@SuppressWarnings("unchecked") public Message<Object> receive() { if (this.invoker == null) { this.afterPropertiesSet(); } try { Object result = this.invoker.invokeMethod(new Object[] {}); if (result == null) { return null; } if (result instanceof Message) { return (Message) result; } return new GenericMessage<Object>(result); } catch (InvocationTargetException e) { throw new MessagingException( "Source method '" + this.methodName + "' threw an Exception.", e.getTargetException()); } catch (Throwable e) { throw new MessagingException("Failed to invoke source method '" + this.methodName + "'."); } }
message = new GenericMessage<flex.messaging.messages.Message>(flexMessage);