Code Monkey home page Code Monkey logo

nsqcore's Introduction

NSQCore

NuGet

An NSQ .NET Core 1.0 client library which targets netstandard 1.4

It is only compatible with nsqio version 1.0.0-compat

This project was originally branched from Turbocharged.NSQ and then converted to .Net Standard 1.4

Usage

Nuget source:

PM> Install-Package NSQCore

Producing Messages

var prod = new NsqProducer("localhost", 4151);
await prod.PublishAsync("topic1", "hello world" );
await prod.SetMaxInFlightAsync(1);

A connection string looks like this:

nsqd=localhost:4151;

Consuming Messages

 var cons = NsqConsumer.Create("lookupd=localhost:4161; topic=topic1; channel=abc");
 await cons.ConnectAndWaitAsync(Handler);
 await cons.SetMaxInFlightAsync(1);
 

 static async Task Handler(Message message)
 {
     Console.WriteLine("Received: Message={0}", message.Body);
     await message.FinishAsync();
 }

Connection string values

A connection string looks like this:

nsqd=localhost:4150;

Or, to use nsqlookupd:

lookup1:4161; lookup2:4161;

A connection string must specify either an nsqd endpoint or nsqlookupd endpoints, but not both.

Setting Description
lookupd={endpoints} List of nsqlookupd servers in the form hostname:httpport, e.g., lookup1:4161;lookup2:4161
nsqd={endpoints} A single nsqd servers in the form hostname:tcpport, e.g., nsqd=server1:4150;nsqd=server2:4150
clientId={string} A string identifying this client to the nsqd server
hostname={string} The hostname to identify as (defaults to Environment.MachineName)
maxInFlight={int} The maximum number of messages this client wants to receive without completion

License

The MIT License. See LICENSE.md.

nsqcore's People

Contributors

kailesh-shah-webjet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.