Post the stactrace so we can see from where the error is thrown.
On Wed, Nov 22, 2017 at 11:01 AM, Yacov Schondorf <[email protected]> wrote: > I am trying to detect when Kafka is not available. I have modified the > example - > > https://github.com/apache/camel/blob/master/examples/camel-example-kafka/src/main/java/org/apache/camel/example/kafka/MessageConsumerClient.java > and > added following code right after camelContext.start() > > > > final Collection<Endpoint> endpoints = camelContext.getEndpoints(); > > for (Endpoint endpoint : endpoints) { > > if (endpoint instanceof DefaultEndpoint) { > > final DefaultEndpoint endpoint1 = (DefaultEndpoint) > endpoint; > > endpoint1.setBridgeErrorHandler(true); > > final HashMap<String, Object> consumerProperties = new > HashMap<>(); > > consumerProperties.put("backoffMultiplier", 10); > > consumerProperties.put("backoffErrorThreshold", 5); > > endpoint1.setConsumerProperties(consumerProperties); > > } > > } > > > > I ran the main() and hoped to see the consumer stopping the attempts to > connect to Kafka after 5 tries, but this did not work. I keep getting > output messages of “Connection to node -1 could not be established. Broker > may not be available.” > > Is this the right way to go? What am I doing wrong? > > > Thanks. -- Claus Ibsen ----------------- http://davsclaus.com @davsclaus Camel in Action 2: https://www.manning.com/ibsen2
