本文整理了Java中org.apache.camel.Message.getMessageId()
方法的一些代码示例,展示了Message.getMessageId()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.getMessageId()
方法的具体详情如下:
包路径:org.apache.camel.Message
类名称:Message
方法名:getMessageId
暂无
代码示例来源:origin: stackoverflow.com
public class MessageAdapter implements JsonSerializer<Message> {
@Override
public JsonElement serialize(Message message, Type type, JsonSerializationContext jsc) {
JsonObject jsonObject = new JsonObject();
jsonObject.addProperty("message_id", message.getMessageId());
jsonObject.addProperty("message", message.getMessage());
jsonObject.addProperty("user", message.getUsers().getUsername());
jsonObject.addProperty("date", message.getDate().toString());
return jsonObject;
}
}
代码示例来源:origin: stackoverflow.com
List<Message> msgList = getList();
// just in case the getNewList() returns null
// check it here---V
for (int i = 0; null!=msgList && i < msgList.size(); i++) {
Message message = msgList.get(i);
String msgType = getMsgTypeFromId(message.getMessageId());
// no need for cascading two ifs. I'm assuming
// MessageType.INCOMING is a "constant" thus bound to never return null
if (MessageType.INCOMING.getType().equals(msgType)) {
// Do some operation
msgList = getNewList();
i = 0;
}
}
代码示例来源:origin: stackoverflow.com
public static void main(String[] args) {
Message m = new Message(23);
System.out.println(m.getMessageId());
}
代码示例来源:origin: io.rhiot/camel-webcam
/**
* Creates an OutOnly exchange with the BufferedImage.
*/
static Exchange createOutOnlyExchangeWithBodyAndHeaders(WebcamEndpoint endpoint, BufferedImage image) throws IOException {
Exchange exchange = endpoint.createExchange(ExchangePattern.OutOnly);
Message message = exchange.getIn();
try (ByteArrayOutputStream output = new ByteArrayOutputStream()) {
ImageIO.write(image, endpoint.getFormat(), output);
message.setBody(new BufferedInputStream(new ByteArrayInputStream(output.toByteArray())));
message.setHeader(Exchange.FILE_NAME, message.getMessageId() + "" + endpoint.getFormat());
}
return exchange;
}
代码示例来源:origin: stackoverflow.com
for (;;) {
ReceiveMessageRequest receiveMessageRequest = new ReceiveMessageRequest(myQueueUrl);
List<Message> messages = sqs.receiveMessage(receiveMessageRequest).getMessages();
for (Message message : messages) {
System.out.println(" Message");
System.out.println(" MessageId: " + message.getMessageId());
System.out.println(" ReceiptHandle: " + message.getReceiptHandle());
System.out.println(" MD5OfBody: " + message.getMD5OfBody());
System.out.println(" Body: " + message.getBody());
for (Entry<String, String> entry : message.getAttributes().entrySet()) {
System.out.println(" Attribute");
System.out.println(" Name: " + entry.getKey());
System.out.println(" Value: " + entry.getValue());
}
}
System.out.println();
}
代码示例来源:origin: org.apache.camel/camel-dropbox
name = exchange.getIn().getMessageId();
代码示例来源:origin: org.apache.camel/camel-zipfile
@Override
public void marshal(final Exchange exchange, final Object graph, final OutputStream stream) throws Exception {
String filename;
String filepath = exchange.getIn().getHeader(FILE_NAME, String.class);
if (filepath == null) {
// generate the file name as the camel file component would do
filename = filepath = StringHelper.sanitize(exchange.getIn().getMessageId());
} else {
filename = Paths.get(filepath).getFileName().toString(); // remove any path elements
}
ZipOutputStream zos = new ZipOutputStream(stream);
if (preservePathElements) {
createZipEntries(zos, filepath);
} else {
createZipEntries(zos, filename);
}
InputStream is = exchange.getContext().getTypeConverter().mandatoryConvertTo(InputStream.class, exchange, graph);
try {
IOHelper.copy(is, zos);
} finally {
IOHelper.close(is, zos);
}
String newFilename = filename + ".zip";
exchange.getOut().setHeader(FILE_NAME, newFilename);
}
代码示例来源:origin: org.apache.camel/camel-tarfile
String entryName = preserveFolderStructure ? newExchange.getIn().getHeader(Exchange.FILE_NAME, String.class) : newExchange.getIn().getMessageId();
addFileToTar(tarFile, appendFile, this.preserveFolderStructure ? entryName : null);
GenericFile<File> genericFile =
String entryName = useFilenameHeader ? newExchange.getIn().getHeader(Exchange.FILE_NAME, String.class) : newExchange.getIn().getMessageId();
addEntryToTar(tarFile, entryName, buffer, buffer.length);
GenericFile<File> genericFile = FileConsumer.asGenericFile(
代码示例来源:origin: org.apache.camel/camel-zipfile
String entryName = preserveFolderStructure ? newExchange.getIn().getHeader(Exchange.FILE_NAME, String.class) : newExchange.getIn().getMessageId();
addFileToZip(zipFile, appendFile, this.preserveFolderStructure ? entryName : null);
GenericFile<File> genericFile =
String entryName = useFilenameHeader ? newExchange.getIn().getHeader(Exchange.FILE_NAME, String.class) : newExchange.getIn().getMessageId();
addEntryToZip(zipFile, entryName, buffer, buffer.length);
GenericFile<File> genericFile = FileConsumer.asGenericFile(
代码示例来源:origin: org.apache.camel/camel-tarfile
if (filepath == null) {
filename = filepath = StringHelper.sanitize(exchange.getIn().getMessageId());
} else {
代码示例来源:origin: com.bosch.bis.monitoring/bis-event-publisher-impl
private RouteExecution beginRouteExecution(Route route, Exchange exchange) {
Date now = Date.from(Instant.now());
RouteExecution routeExchange = new RouteExecution();
routeExchange.setRouteBeginDate(now);
routeExchange.setRouteId(route.getId());
routeExchange.setExchangeId(exchange.getExchangeId());
routeExchange.setMessageId(exchange.getIn().getMessageId());
routeExchange.setFromEndpointUri(exchange.getFromEndpoint().getEndpointUri());
routeExchange.setFromEndpointId(getEndpointId(exchange.getFromEndpoint()));
routeExchange.setFromRouteId(exchange.getFromRouteId());
Date created = exchange.getProperty(Exchange.CREATED_TIMESTAMP, Date.class);
routeExchange.setExchangeCreatedDate(created.getTime());
return routeExchange;
}
代码示例来源:origin: org.apache.camel/camel-spring-integration
@Override
public void copyFrom(org.apache.camel.Message that) {
if (that == this) {
// the same instance so do not need to copy
return;
}
if (that instanceof CamelContextAware) {
this.setCamelContext(((CamelContextAware) that).getCamelContext());
}
// cover over exchange if none has been assigned
if (getExchange() == null) {
setExchange(that.getExchange());
}
setMessageId(that.getMessageId());
setBody(that.getBody());
super.getHeaders().putAll(that.getHeaders());
if (that instanceof SpringIntegrationMessage) {
SpringIntegrationMessage orig = (SpringIntegrationMessage) that;
setMessage(orig.getMessage());
}
getAttachments().putAll(that.getAttachments());
}
代码示例来源:origin: org.apache.camel/camel-jms
setMessageId(that.getMessageId());
代码示例来源:origin: org.apache.camel/camel-mail
public void copyFrom(org.apache.camel.Message that) {
// only do a deep copy if we need to (yes when that is not a mail message, or if the mapMailMessage is true)
boolean needCopy = !(that instanceof MailMessage) || (((MailMessage) that).mapMailMessage);
if (needCopy) {
super.copyFrom(that);
} else {
// no deep copy needed, but copy message id
setMessageId(that.getMessageId());
setFault(that.isFault());
}
if (that instanceof MailMessage) {
MailMessage mailMessage = (MailMessage) that;
this.originalMailMessage = mailMessage.originalMailMessage;
this.mailMessage = mailMessage.mailMessage;
this.mapMailMessage = mailMessage.mapMailMessage;
}
// cover over exchange if none has been assigned
if (getExchange() == null) {
setExchange(that.getExchange());
}
}
代码示例来源:origin: com.bluelock/camel-spring-amqp
@Override
public Message postProcessMessage(Message msg) throws AmqpException {
if(camelMessage == null || camelMessage.getHeaders() == null)
return msg;
//Set headers
msg = SpringAMQPHeader.setBasicPropertiesFromHeaders(msg, camelMessage.getHeaders());
msg = SpringAMQPHeader.copyHeaders(msg, camelMessage.getHeaders());
//Set the exchange pattern so we can re-set it upon receipt
if(camelMessage.getExchange() != null) {
String exchangePattern = camelMessage.getExchange().getPattern().name();
msg.getMessageProperties().setHeader(EXCHANGE_PATTERN, exchangePattern);
} else {
throw new IllegalStateException("No exchange was found for this message "+camelMessage.getMessageId());
}
return msg;
}
}
代码示例来源:origin: Bluelock/camel-spring-amqp
@Override
public Message postProcessMessage(Message msg) throws AmqpException {
if(camelMessage == null || camelMessage.getHeaders() == null)
return msg;
//Set headers
msg = SpringAMQPHeader.setBasicPropertiesFromHeaders(msg, camelMessage.getHeaders());
msg = SpringAMQPHeader.copyHeaders(msg, camelMessage.getHeaders());
//Set the exchange pattern so we can re-set it upon receipt
if(camelMessage.getExchange() != null) {
String exchangePattern = camelMessage.getExchange().getPattern().name();
msg.getMessageProperties().setHeader(EXCHANGE_PATTERN, exchangePattern);
} else {
throw new IllegalStateException("No exchange was found for this message "+camelMessage.getMessageId());
}
return msg;
}
}
代码示例来源:origin: org.switchyard/switchyard-bus-camel
@Override
public void send(Message message) {
org.apache.camel.Message camelMsg = extract(message);
if (getPhase() == null) {
_exchange.setProperty(PHASE, ExchangePhase.IN);
_exchange.setIn(camelMsg);
getContext().setProperty(Exchange.MESSAGE_ID, camelMsg.getMessageId());
initInContentType();
} else {
_exchange.setProperty(PHASE, ExchangePhase.OUT);
String id = getContext().getPropertyValue(MESSAGE_ID);
_exchange.setIn(camelMsg);
getContext().setProperty(Exchange.RELATES_TO, id);
getContext().setProperty(Exchange.MESSAGE_ID, camelMsg.getMessageId());
initOutContentType();
}
sendInternal();
}
代码示例来源:origin: jboss-switchyard/core
@Override
public void send(Message message) {
org.apache.camel.Message camelMsg = extract(message);
if (getPhase() == null) {
_exchange.setProperty(PHASE, ExchangePhase.IN);
_exchange.setIn(camelMsg);
getContext().setProperty(Exchange.MESSAGE_ID, camelMsg.getMessageId());
initInContentType();
} else {
_exchange.setProperty(PHASE, ExchangePhase.OUT);
String id = getContext().getPropertyValue(MESSAGE_ID);
_exchange.setIn(camelMsg);
getContext().setProperty(Exchange.RELATES_TO, id);
getContext().setProperty(Exchange.MESSAGE_ID, camelMsg.getMessageId());
initOutContentType();
}
sendInternal();
}
代码示例来源:origin: org.switchyard/switchyard-bus-camel
@Override
public void sendFault(Message message) {
org.apache.camel.Message extract = extract(message);
_exchange.setProperty(PHASE, ExchangePhase.OUT);
String id = getContext().getPropertyValue(MESSAGE_ID);
_exchange.setIn(extract);
_exchange.setProperty(FAULT, true);
getContext().setProperty(Exchange.RELATES_TO, id);
getContext().setProperty(Exchange.MESSAGE_ID, extract.getMessageId());
org.switchyard.Property rollbackOnFaultProperty = getContext().getProperty(org.switchyard.Exchange.ROLLBACK_ON_FAULT);
if (rollbackOnFaultProperty == null || rollbackOnFaultProperty.getValue() == null) {
getContext().setProperty(org.switchyard.Exchange.ROLLBACK_ON_FAULT, Boolean.FALSE, Scope.EXCHANGE);
}
sendInternal();
}
代码示例来源:origin: jboss-switchyard/core
@Override
public void sendFault(Message message) {
org.apache.camel.Message extract = extract(message);
_exchange.setProperty(PHASE, ExchangePhase.OUT);
String id = getContext().getPropertyValue(MESSAGE_ID);
_exchange.setIn(extract);
_exchange.setProperty(FAULT, true);
getContext().setProperty(Exchange.RELATES_TO, id);
getContext().setProperty(Exchange.MESSAGE_ID, extract.getMessageId());
org.switchyard.Property rollbackOnFaultProperty = getContext().getProperty(org.switchyard.Exchange.ROLLBACK_ON_FAULT);
if (rollbackOnFaultProperty == null || rollbackOnFaultProperty.getValue() == null) {
getContext().setProperty(org.switchyard.Exchange.ROLLBACK_ON_FAULT, Boolean.FALSE, Scope.EXCHANGE);
}
sendInternal();
}
内容来源于网络,如有侵权,请联系作者删除!