{"id":13430542,"url":"https://github.com/NetMQ/NetMQ.ReactiveExtensions","last_synced_at":"2025-03-16T05:31:19.325Z","repository":{"id":71718144,"uuid":"51267731","full_name":"NetMQ/NetMQ.ReactiveExtensions","owner":"NetMQ","description":"Effortlessly send messages anywhere on the network using Reactive Extensions (RX). Transport protocol is ZeroMQ.","archived":false,"fork":false,"pushed_at":"2017-12-14T11:38:30.000Z","size":2582,"stargazers_count":67,"open_issues_count":9,"forks_count":14,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-03-06T21:46:24.677Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NetMQ.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-02-07T21:42:35.000Z","updated_at":"2024-12-26T07:02:39.000Z","dependencies_parsed_at":"2023-02-23T15:45:17.729Z","dependency_job_id":null,"html_url":"https://github.com/NetMQ/NetMQ.ReactiveExtensions","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NetMQ%2FNetMQ.ReactiveExtensions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NetMQ%2FNetMQ.ReactiveExtensions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NetMQ%2FNetMQ.ReactiveExtensions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NetMQ%2FNetMQ.ReactiveExtensions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NetMQ","download_url":"https://codeload.github.com/NetMQ/NetMQ.ReactiveExtensions/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243830912,"owners_count":20354848,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T02:00:55.045Z","updated_at":"2025-03-16T05:31:18.363Z","avatar_url":"https://github.com/NetMQ.png","language":"C#","readme":"# NetMQ.ReactiveExtensions\n\n[![Build](https://img.shields.io/appveyor/ci/drewnoakes/netmq-reactiveextensions.svg)](https://ci.appveyor.com/project/drewnoakes/netmq-reactiveextensions) [![NuGet](https://img.shields.io/nuget/v/NetMQ.ReactiveExtensions.svg)](https://www.nuget.org/packages/NetMQ.ReactiveExtensions/) [![NuGet prerelease](https://img.shields.io/nuget/vpre/NetMQ.ReactiveExtensions.svg)](https://www.nuget.org/packages/NetMQ.ReactiveExtensions/)\n\nEffortlessly send messages anywhere on the network using Reactive Extensions (RX). Uses NetMQ as the transport layer. \n\nFast! Runs at \u003e120,000 messages per second on localhost (by comparison, Tibco runs at 100,000 on the same machine).\n\n## Sample Code\n\nThe API is a drop-in replacement for `Subject\u003cT\u003e` from Reactive Extensions (RX).\n\nAs a refresher, to use `Subject\u003cT\u003e` in Reactive Extensions (RX):\n\n```csharp \nvar subject = new Subject\u003cint\u003e();\nsubject.Subscribe(message =\u003e\n{\n    // If we get an error \"Cannot convert lambda ... not a delegate type\", install Reactive Extensions from NuGet.\n    Console.Write(message); // Prints \"42\".\n});\nsubject.OnNext(42);\n```\n\nThe new API starts with a drop-in replacement for `Subject\u003cT\u003e`:\n\n```csharp\nvar subject = new SubjectNetMQ\u003cint\u003e(\"tcp://127.0.0.1:56001\");\nsubject.Subscribe(message =\u003e\n{\n    Console.Write(message); // Prints \"42\".\n});\nsubject.OnNext(42); // Sends 42.\n```\n\nThis is great for a demo, but is not recommended for any real life application.\n\nFor those of us familiar with Reactive Extensions (RX), `Subject\u003cT\u003e` is a combination of a publisher and a subscriber. If we are running a real-life application, we should separate out the publisher and the subscriber, because this means we can create the connection earlier which makes the transport setup more deterministic:\n\n```csharp\nvar publisher = new PublisherNetMq\u003cint\u003e(\"tcp://127.0.0.1:56001\");\nvar subscriber = new SubscriberNetMq\u003cint\u003e(\"tcp://127.0.0.1:56001\");\nsubscriber.Subscribe(message =\u003e\n{\n\tConsole.Write(message); // Prints \"42\".\n});\npublisher.OnNext(42); // Sends 42.\n```\n\nIf we want to run in separate applications:\n\n```csharp\n// Application 1 (subscriber)\nvar subscriber1 = new SubscriberNetMq\u003cint\u003e(\"tcp://127.0.0.1:56001\");\nsubscriber1.Subscribe(message =\u003e\n{\n    Console.Write(message); // Prints \"42\".\n});\n\n// Application 2 (subscriber)\nvar subscriber2 = new SubscriberNetMq\u003cint\u003e(\"tcp://127.0.0.1:56001\");\nsubscriber2.Subscribe(message =\u003e\n{\n    Console.Write(message); // Prints \"42\".\n});\n\n// Application 3 (publisher)\nvar publisher = new PublisherNetMq\u003cint\u003e(\"tcp://127.0.0.1:56001\");\npublisher.OnNext(42); // Sends 42.\n```\n\nCurrently, serialization is performed using [ProtoBuf](https://github.com/mgravell/protobuf-net \"ProtoBuf\"). It will handle simple types such as `int` without annotation, but if we want to send more complex classes, we have to annotate like this:\n\n```csharp\n// For Protobuf support, include NuGet package protobuf-net from Marc Gravell.\n[ProtoContract]\npublic struct MyMessage\n{\n    [ProtoMember(1)]\n    public int Num { get; set; }\n    [ProtoMember(2)]\n    public string Name { get; set; }\n}\n\nvar publisher = new PublisherNetMq\u003cMyMessage\u003e(\"tcp://127.0.0.1:56001\");\nvar subscriber = new SubscriberNetMq\u003cMyMessage\u003e(\"tcp://127.0.0.1:56001\");\nsubscriber.Subscribe(message =\u003e\n{\n    Console.Write(message.Num); // Prints \"42\".\n    Console.Write(message.Name); // Prints \"Bill\".\n});\npublisher.OnNext(new MyMessage(42, \"Bill\"); \n```\n\n## NuGet Package\n\n[![Build](https://img.shields.io/appveyor/ci/drewnoakes/netmq-reactiveextensions.svg)](https://ci.appveyor.com/project/drewnoakes/netmq-reactiveextensions) [![NuGet](https://img.shields.io/nuget/v/NetMQ.ReactiveExtensions.svg)](https://www.nuget.org/packages/NetMQ.ReactiveExtensions/) [![NuGet prerelease](https://img.shields.io/nuget/vpre/NetMQ.ReactiveExtensions.svg)](https://www.nuget.org/packages/NetMQ.ReactiveExtensions/)\n\nSee [NetMQ.ReactiveExtensions](https://www.nuget.org/packages/NetMQ.ReactiveExtensions/).\n\nThe NuGet package 0.9.3 is designed for .NET 4. It depends on Reactive Extensions v2.2.5 (this is difficult to find, can download the packages manually from NuGet).\n\nThe NuGet package 0.9.4-rc7 is designed .NET Core 1.1, .NET 4.5, and .NET Standard 1.6. If you want to build it for other platforms, please let me know. If you have trouble loading this, load the Git branch for the 0.9.3 release.\n\n## .NET Core 1.1 Ready\n\nAs of v0.9.4-rc7, this package will build for:\n- .NET 4.5 and up\n- [.NET Core 1.1](https://www.microsoft.com/net/download/core)\n- .NET Standard 1.6 and up\n\nAs this library supports .NET Standard 1.6 (which is a subset of .NET Core 1.1), this library should be compatible with:\n- Windows\n- Linux\n- Mac\n\nThis library is tested on Window and Linux. If it passes it's unit tests on any given platform, then it should perform nicely on different architectures such as Mac.\n\n## Compiling from source\n\n- Install [Visual Studio 2015 Update 3](https://www.visualstudio.com/en-us/news/releasenotes/vs2015-update3-vs).\n- Install \"[.NET Core 1.1 SDK - Installer](https://www.microsoft.com/net/download/core)\" from https://www.microsoft.com/net/download/core.\n- NuGet Restore. It may not compile until a manual \"[nuget restore](https://docs.nuget.org/ndocs/consume-packages/package-restore)\" is performed for each project (this also rebuilds the `project.lock.json` file). You can either do this from the command line, or by right clicking on  the solution and choosing `Restore NuGet packages`.\n- If the project does not compile on your machine, raise an issue here on GitHub.\n\nNOTE: Not compatible with .NET Core 1.0 or .NET Core 1.0.1. Must install .NET Core 1.1 and above to avoid potential compile errors.\n\n## Demos\n\nTo check out the demos, see:\n- Publisher: Project `NetMQ.ReactiveExtensions.SamplePublisher`\n- Subscriber: Project `NetMQ.ReactiveExtensions.SampleSubscriber`\n- Sample unit tests: Project `NetMQ.ReactiveExtensions.Tests`\n\n## Performance\n\n- Runs at \u003e120,000 messages per second on localhost.\n\n## 100% compatible with Reactive Extensions (RX) \n\n- Compatible with all existing Reactive Extensions code, as it implements IObservable\u003cT\u003e and IObserver\u003cT\u003e from Microsoft.\n- Can use `.Where()`, `.Select()`, `.Buffer()`, `.Throttle()`, etc.\n- Supports `.OnNext()`, `.OnException()`, and `.OnCompleted()`.\n- Properly passes exceptions across the wire.\n\n## Unit tests\n\n- Supported by a full suite of unit tests.\n\n## Projects like this one that do messaging\n\n- See [Obvs](https://github.com/inter8ection/Obvs), an fantastic RX wrapper which supports many transport layers including NetMQ, RabbitMQ and Azure, and many serialization methods including ProtoBuf and MsgPack.\n- See [Obvs.NetMQ](https://github.com/inter8ection/Obvs.Netmq), the RX wrapper with NetMQ as the transport layer. \n- Search for [all packages on NuGet that depend on RX](http://nugetmusthaves.com/Dependencies/Rx-Linq), and pick out the ones that are related to message buses.\n- Check out Kafka. It provides many-to-many messaging, with persistance, and multi-node redundancy. And its blindingly fast.\n\n## Wiki\n\nSee the [Wiki with more documentation](https://github.com/NetMQ/NetMQ.ReactiveExtensions/wiki).\n\n\n\n","funding_links":[],"categories":["Frameworks, Libraries and Tools","框架, 库和工具","Functional Programming"],"sub_categories":["Functional Programming","响应式编程"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNetMQ%2FNetMQ.ReactiveExtensions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FNetMQ%2FNetMQ.ReactiveExtensions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNetMQ%2FNetMQ.ReactiveExtensions/lists"}