use of org.snmp4j.smi.TcpAddress in project camel by apache.
the class SnmpTrapConsumer method doStart.
@Override
protected void doStart() throws Exception {
super.doStart();
// load connection data only if the endpoint is enabled
if (LOG.isInfoEnabled()) {
LOG.info("Starting trap consumer on {}", this.endpoint.getAddress());
}
this.listenGenericAddress = GenericAddress.parse(this.endpoint.getAddress());
// either tcp or udp
if ("tcp".equals(endpoint.getProtocol())) {
this.transport = new DefaultTcpTransportMapping((TcpAddress) this.listenGenericAddress);
} else if ("udp".equals(endpoint.getProtocol())) {
this.transport = new DefaultUdpTransportMapping((UdpAddress) this.listenGenericAddress);
} else {
throw new IllegalArgumentException("Unknown protocol: " + endpoint.getProtocol());
}
this.snmp = new Snmp(transport);
this.snmp.addCommandResponder(this);
// listen to the transport
if (LOG.isDebugEnabled()) {
LOG.debug("Starting trap consumer on {} using {} protocol", endpoint.getAddress(), endpoint.getProtocol());
}
this.transport.listen();
if (LOG.isInfoEnabled()) {
LOG.info("Started trap consumer on {} using {} protocol", endpoint.getAddress(), endpoint.getProtocol());
}
}
Aggregations