Thank you Claus for your immediate reply.
Here i am describing the problem:
I am using camel-snmp component to communicate with the SNMP supported switches. Here is an example which we are using:
final CamelContext context = new DefaultCamelContext();
context.addRoutes(
new RouteBuilder() {
@Override
public void configure() throws Exception {
// TODO Auto-generated method stub
from(snmpSwitchURI)
.process(new Processor() {
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void process(final
Exchange exchange)
throws Exception {
// TODO Auto-generated method stub
final Object object = (Object) exchange.getIn()
.getBody();
if (object instanceof List) {
final List<TableEvent> tableEvents = (List) object;
// QE & Dev verification raw data which we are
// getting from Camel
LOGGER.debug("Performance metrics raw data:\n"
+ tableEvents);
if (!tableEvents.isEmpty()) {
final Map perfMetrics = processTableEvents(
object, ipAddress);
exchange.getIn().setBody(
convertToSRMFormat(dcfAttributes,
perfMetrics, ipAddress));
}
}
}
}).marshal().json(JsonLibrary.Jackson)
.convertBodyTo(String.class)
.process(new Processor() {
@Override
public void process(final Exchange exchange)
throws Exception {
srmJsonData.add(exchange.getIn().getBody());
}
});
}
}
);
context.start();
Thread.sleep(4000); // We are setting the thread to sleep for 4sec.
context.stop();
Here we have extended camel to support SNMP4j TableUtils using SNMP V3. Here we will get TableEvents from the SNMP4J framework. We are establishing the route and to receive the TableEvents is taking some times more than 4 Sec or less than 4 Sec. If it takes more than 4 Sec we are not getting the TableEvents. Hence we thought of making it dynamic like after finishing the context routing process, we want to get the TableEvent instead of setting Thread.sleep(). Please provide how can i overcome this issue.