use of org.apache.camel.component.syslog.netty.Rfc5425FrameDecoder in project camel by apache.
the class NettyRfc5425LongMessageTest method createRouteBuilder.
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
context().getRegistry(JndiRegistry.class).bind("rfc5426FrameDecoder", new Rfc5425FrameDecoder());
return new RouteBuilder() {
@Override
public void configure() throws Exception {
context.setTracing(true);
DataFormat syslogDataFormat = new SyslogDataFormat();
// we setup a Syslog listener on a random port.
from(uri).unmarshal(syslogDataFormat).process(new Processor() {
@Override
public void process(Exchange ex) {
assertTrue(ex.getIn().getBody() instanceof SyslogMessage);
}
}).to("mock:syslogReceiver").marshal(syslogDataFormat).to("mock:syslogReceiver2");
// Here we need to turn the request body into ByteBuf
from("direct:start").convertBodyTo(ByteBuf.class).to(uri);
}
};
}
use of org.apache.camel.component.syslog.netty.Rfc5425FrameDecoder in project camel by apache.
the class NettyRfc5425Test method createRouteBuilder.
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
context().getRegistry(JndiRegistry.class).bind("rfc5426FrameDecoder", new Rfc5425FrameDecoder());
return new RouteBuilder() {
@Override
public void configure() throws Exception {
context.setTracing(true);
DataFormat syslogDataFormat = new SyslogDataFormat();
// we setup a Syslog listener on a random port.
from(uri).unmarshal(syslogDataFormat).process(new Processor() {
@Override
public void process(Exchange ex) {
assertTrue(ex.getIn().getBody() instanceof SyslogMessage);
}
}).to("mock:syslogReceiver").marshal(syslogDataFormat).to("mock:syslogReceiver2");
from("direct:checkStructuredData").unmarshal(syslogDataFormat).process(new Processor() {
@Override
public void process(Exchange ex) {
Object body = ex.getIn().getBody();
assertTrue(body instanceof Rfc5424SyslogMessage);
assertEquals("[exampleSDID@32473 iut=\"3\" eventSource=\"Application\" eventID=\"1011\"]", ((Rfc5424SyslogMessage) body).getStructuredData());
}
}).to("mock:syslogReceiver");
}
};
}
use of org.apache.camel.component.syslog.netty.Rfc5425FrameDecoder in project camel by apache.
the class NettyRfc5425LongMessageTest method createRegistry.
@Override
protected JndiRegistry createRegistry() throws Exception {
JndiRegistry jndi = super.createRegistry();
jndi.bind("decoder", new Rfc5425FrameDecoder());
jndi.bind("encoder", new Rfc5425Encoder());
return jndi;
}
use of org.apache.camel.component.syslog.netty.Rfc5425FrameDecoder in project camel by apache.
the class NettyRfc5425Test method createRegistry.
@Override
protected JndiRegistry createRegistry() throws Exception {
JndiRegistry jndi = super.createRegistry();
jndi.bind("decoder", new Rfc5425FrameDecoder());
jndi.bind("encoder", new Rfc5425Encoder());
return jndi;
}
Aggregations