# JavaNSQClient **Repository Path**: rock10024/JavaNSQClient ## Basic Information - **Project Name**: JavaNSQClient - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2019-05-20 - **Last Updated**: 2020-12-18 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## JavaNSQClient A (fast?) netty-based Java8 client for [NSQ](https://nsq.io) heavily forked of TrendrrNSQClient. ## Artifact ``` com.github.brainlag nsq-client 1.0.0.RC4 ``` ## Consumer Example usage: ``` NSQLookup lookup = new DefaultNSQLookup(); lookup.addLookupAddress("localhost", 4161); NSQConsumer consumer = new NSQConsumer(lookup, "speedtest", "dustin", (message) -> { System.out.println("received: " + message); //now mark the message as finished. message.finished(); //or you could requeue it, which indicates a failure and puts it back on the queue. //message.requeue(); }); consumer.start(); ``` ## Producer Example usage: ``` NSQProducer producer = new NSQProducer().addAddress("localhost", 4150).start(); producer.produce("TestTopic", ("this is a message").getBytes()); ``` ## Backoff By default Backoff does not kick in and a consumer will eat all your memory and CPU. To enable Backoff you have to set your own thread pool executer with: ``` consumer.setExecutor(...); ```