use of org.apache.camel.impl.DefaultMessage in project camel by apache.
the class ZooKeeperUtilsTest method testModeInMessage.
private CreateMode testModeInMessage(String mode, CreateMode defaultMode) {
Message m = new DefaultMessage();
m.setHeader(ZooKeeperMessage.ZOOKEEPER_CREATE_MODE, mode);
return getCreateMode(m, defaultMode);
}
use of org.apache.camel.impl.DefaultMessage in project camel by apache.
the class ZipIterator method getNextElement.
private Message getNextElement() {
if (zipInputStream == null) {
return null;
}
try {
ZipEntry current = getNextEntry();
if (current != null) {
LOGGER.debug("read zipEntry {}", current.getName());
Message answer = new DefaultMessage();
answer.getHeaders().putAll(inputMessage.getHeaders());
answer.setHeader("zipFileName", current.getName());
answer.setHeader(Exchange.FILE_NAME, current.getName());
answer.setBody(new ZipInputStreamWrapper(zipInputStream));
return answer;
} else {
LOGGER.trace("close zipInputStream");
return null;
}
} catch (IOException exception) {
//Just wrap the IOException as CamelRuntimeException
throw new RuntimeCamelException(exception);
}
}
use of org.apache.camel.impl.DefaultMessage in project camel by apache.
the class TarIterator method getNextElement.
private Message getNextElement() {
if (tarInputStream == null) {
return null;
}
try {
TarArchiveEntry current = getNextEntry();
if (current != null) {
LOGGER.debug("Reading tarEntry {}", current.getName());
Message answer = new DefaultMessage();
answer.getHeaders().putAll(inputMessage.getHeaders());
answer.setHeader(TARFILE_ENTRY_NAME_HEADER, current.getName());
answer.setHeader(Exchange.FILE_NAME, current.getName());
if (current.getSize() > 0) {
answer.setBody(new TarElementInputStreamWrapper(tarInputStream));
} else {
// Workaround for the case when the entry is zero bytes big
answer.setBody(new ByteArrayInputStream(new byte[0]));
}
return answer;
} else {
LOGGER.trace("Closed tarInputStream");
return null;
}
} catch (IOException exception) {
//Just wrap the IOException as CamelRuntimeException
throw new RuntimeCamelException(exception);
}
}
use of org.apache.camel.impl.DefaultMessage in project camel by apache.
the class AbstractProducerTestSupport method before.
@Before
public void before() throws IOException {
msg = new DefaultMessage();
when(exchange.getIn()).thenReturn(msg);
}
use of org.apache.camel.impl.DefaultMessage in project camel by apache.
the class RabbitMQMessageConverter method resolveMessageFrom.
private Message resolveMessageFrom(final Exchange camelExchange, final boolean out) {
Message message;
if (out) {
// use OUT message
message = camelExchange.getOut();
} else {
if (camelExchange.getIn() != null) {
// Use the existing message so we keep the headers
message = camelExchange.getIn();
} else {
message = new DefaultMessage();
camelExchange.setIn(message);
}
}
return message;
}
Aggregations