JavaNSQClient

Fast Java client for NSQ.

License

License

Categories

Categories

CLI User Interface
GroupId

GroupId

fr.vsct.dt
ArtifactId

ArtifactId

nsq-client
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

JavaNSQClient
Fast Java client for NSQ.
Project URL

Project URL

https://github.com/voyages-sncf-technologies/JavaNSQClient
Source Code Management

Source Code Management

https://github.com/voyages-sncf-technologies/JavaNSQClient

Download nsq-client

How to add to project

<!-- https://jarcasting.com/artifacts/fr.vsct.dt/nsq-client/ -->
<dependency>
    <groupId>fr.vsct.dt</groupId>
    <artifactId>nsq-client</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/fr.vsct.dt/nsq-client/
implementation 'fr.vsct.dt:nsq-client:1.0.0'
// https://jarcasting.com/artifacts/fr.vsct.dt/nsq-client/
implementation ("fr.vsct.dt:nsq-client:1.0.0")
'fr.vsct.dt:nsq-client:jar:1.0.0'
<dependency org="fr.vsct.dt" name="nsq-client" rev="1.0.0">
  <artifact name="nsq-client" type="jar" />
</dependency>
@Grapes(
@Grab(group='fr.vsct.dt', module='nsq-client', version='1.0.0')
)
libraryDependencies += "fr.vsct.dt" % "nsq-client" % "1.0.0"
[fr.vsct.dt/nsq-client "1.0.0"]

Dependencies

compile (5)

Group / Artifact Type Version
org.slf4j : slf4j-api jar 1.7.21
io.netty : netty-all jar 4.0.34.Final
com.google.guava : guava jar 19.0
com.fasterxml.jackson.core : jackson-databind jar 2.6.4
org.apache.commons : commons-pool2 jar 2.4.2

test (2)

Group / Artifact Type Version
junit : junit jar 4.12
io.netty : netty-tcnative jar 1.1.33.Fork11

Project Modules

There are no modules declared in this project.

JavaNSQClient

A (fast?) netty-based Java8 client for NSQ

heavily forked of TrendrrNSQClient. --> heavily forked from Brainlag version

Artifact

<dependency>
  <groupId>com.vsct.dt</groupId>
  <artifactId>nsq-client</artifactId>
  <version>1.0.0-SNAPSHOT</version>
</dependency>

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(...);
fr.vsct.dt

E-Voyageurs Technologies

Versions

Version
1.0.0