本文整理了Java中org.apache.camel.Message.getBody()
方法的一些代码示例,展示了Message.getBody()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.getBody()
方法的具体详情如下:
包路径:org.apache.camel.Message
类名称:Message
方法名:getBody
暂无
代码示例来源:origin: deeplearning4j/nd4j
@Override
public void process(Exchange exchange) throws Exception {
byte[] body2 = (byte[]) exchange.getIn().getBody();
String body = new String(body2);
INDArray arr = Nd4jBase64.fromBase64(body);
exchange.getIn().setBody(arr);
}
}).to("direct:receive");
代码示例来源:origin: deeplearning4j/nd4j
@Override
public void process(Exchange exchange) throws Exception {
final INDArray arr = (INDArray) exchange.getIn().getBody();
ByteArrayOutputStream bos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(bos);
Nd4j.write(arr, dos);
byte[] bytes = bos.toByteArray();
String base64 = Base64.encodeBase64String(bytes);
exchange.getIn().setBody(base64, String.class);
String id = UUID.randomUUID().toString();
exchange.getIn().setHeader(KafkaConstants.KEY, id);
exchange.getIn().setHeader(KafkaConstants.PARTITION_KEY, id);
}
}).to(kafkaUri);
代码示例来源:origin: org.apache.camel/camel-spring
public Object getBody() {
return exchange.getIn().getBody();
}
代码示例来源:origin: org.apache.camel/camel-spring
protected ApplicationEvent toApplicationEvent(Exchange exchange) {
ApplicationEvent event = exchange.getIn().getBody(ApplicationEvent.class);
if (event != null) {
return event;
}
return new CamelEvent(this, exchange);
}
}
代码示例来源:origin: org.openehealth.ipf.platform-camel/ipf-platform-camel-flow
private byte[] getInBody(Exchange exchange) {
Message in = exchange.getIn();
if (in.getBody() == null) {
return null;
}
if (inFormat != null) {
return marshal(in.getBody(), exchange, inFormat);
} else if (inType != null) {
in.setBody(in.getBody(inType));
}
return in.getBody(byte[].class);
}
代码示例来源:origin: camelinaction/camelinaction2
@Override
public void process(Exchange exchange) throws Exception {
Integer counter = exchange.getIn().getBody(Integer.class);
if (counter == null) {
counter = 0;
}
counter++;
exchange.getIn().setBody(counter);
}
})
代码示例来源:origin: org.apache.camel/camel-cdi
@Override
public void process(Exchange exchange) {
logger.debug("Firing CDI event [{}] with {}", event, this);
// TODO: leverage Camel type converter mechanism based on the endpoint type
// The EventMetadata injection point will be that of the event which is not very useful
// for the end user. Using BeanManager.fire would be a way to hide that internal though
// it will be necessary to check whether the exchange event type is assignable to the
// endpoint event type.
event.fire((T) exchange.getIn().getBody());
}
}
代码示例来源:origin: camelinaction/camelinaction2
public Exchange aggregate(String system, Exchange oldExchange, Exchange newExchange) {
// the first time oldExchange is null so we got to look out for that
Exchange answer = oldExchange == null ? newExchange : oldExchange;
// store data temporary in headers so we can combine data later
answer.getIn().setHeader(system, newExchange.getIn().getBody());
return answer;
}
代码示例来源:origin: OpenNMS/opennms
@Override
public void process(final Exchange exchange) throws Exception {
final NorthboundAlarm alarm = exchange.getIn().getBody(NorthboundAlarm.class);
exchange.getIn().setBody(alarm.toString(), String.class);
}
}
代码示例来源:origin: OpenNMS/opennms
@Override
public void process(final Exchange exchange) throws Exception {
final Object object = exchange.getIn().getBody(m_class);
exchange.getIn().setBody(JaxbUtils.marshal(object), String.class);
}
}
代码示例来源:origin: stackoverflow.com
// Note: Content Type - might need treatment!
public class AttachmentAttacher{
public void process(Exchange exchange){
Message in = exchange.getIn();
byte[] file = in.getBody(byte[].class);
String fileId = in.getHeader("CamelFileName",String.class);
in.addAttachment(fileId, new DataHandler(file,"plain/text"));
}
}
代码示例来源:origin: at.researchstudio.sat/won-core
@Override
public void inspectMessage(Exchange exchange) {
if (!logger.isDebugEnabled()) {
return;
}
inspectProperties(exchange);
inspectHeaders(exchange);
if(exchange.getIn().getBody()!=null) {
logger.debug(exchange.getIn().getBody().toString());
}
}
public void inspectProperties(Exchange exchange){
代码示例来源:origin: org.apache.camel/camel-hazelcast
private void add(Exchange exchange) {
final Object body = exchange.getIn().getBody();
exchange.getOut().setBody(ringbuffer.add(body));
}
}
代码示例来源:origin: org.apache.camel/camel-hazelcast
private void publish(Exchange exchange) {
Object body = exchange.getIn().getBody();
this.topic.publish(body);
}
}
代码示例来源:origin: org.apache.camel/camel-hazelcast
private void retainAll(Exchange exchange) {
Collection body = exchange.getIn().getBody(Collection.class);
this.queue.retainAll(body);
}
}
代码示例来源:origin: org.apache.camel/camel-tarfile
public Object evaluate(Exchange exchange) {
Message inputMessage = exchange.getIn();
InputStream inputStream = inputMessage.getBody(InputStream.class);
return new TarIterator(exchange, inputStream);
}
代码示例来源:origin: org.fornax.cartridges/fornax-cartridges-sculptor-framework
public void process(Exchange exchange) throws Exception {
Event event = (Event) exchange.getIn().getBody();
subscriber.receive(event);
}
});
代码示例来源:origin: io.syndesis/sql-stored-connector
@Override
public Processor getAfterProducer() {
final Processor processor = exchange -> {
@SuppressWarnings("unchecked")
Map<String,Object> map = exchange.getIn().getBody(Map.class);
String jsonBean = JSONBeanUtil.toJSONBean(map);
exchange.getIn().setBody(jsonBean);
};
return processor;
}
代码示例来源:origin: io.syndesis.connector/connector-fhir
private void beforeProducer(Exchange exchange) {
final Message in = exchange.getIn();
final FhirUpdateMessageModel fhirUpdateMessageModel = exchange.getIn().getBody(FhirUpdateMessageModel.class);
if (fhirUpdateMessageModel != null && fhirUpdateMessageModel.getResource() != null) {
this.resource = fhirUpdateMessageModel.getResource();
} else {
this.resource = in.getBody(String.class);
}
LOG.info("Updating resource" + this.resource);
in.setHeader("CamelFhir.resourceAsString", this.resource);
}
}
代码示例来源:origin: org.fusesource.eca/eca-core
protected Map<String, Number> getNumbersFromExchange(Exchange exchange) throws Exception {
Map<String, Number> result = null;
//try and extract something from the Message to monitor
Object payload = exchange.getIn().getBody();
if (payload != null) {
result = PropertyUtil.getValues(Number.class, payload);
}
return result;
}
内容来源于网络,如有侵权,请联系作者删除!