Distributed programming

Introducing ZeroMQ with C# and Java native port

Zeromq is a messaging library written in C++ for building distributed applications. The library can be used when performance and stability both matters. In addition to the original library, there are bindings in language such as C# or Java that wraps the C++ dll. Moreover, 100% native ports exists in these same languages. In this post, I will use Jeromq (Java) and Netmq (.Net) to make a client and a server communicate in a very simple request-reply pattern.

The server in C#

We need to download the latest version of Netmq via Nuget. The server binds to an address so that client can connect to it, receives a message (the request) and sends a message (the reply).

The client in Java

We need to include the dependencies in the Maven file pom.xml.

Then we can create the client application. The client connects to the server, sends a message (the request), and receives a message (the reply).

Zeromq and their related ports can also be used in other patterns like publish-subscribe, push-pull, exclusive pair, etc… This might be a topic of an other post …

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s