This is a mirror of official site: http://jasper-net.blogspot.com/

ZeroMQ via C#: Multi-part messages, JSON and Synchronized PUB-SUB pattern

| Wednesday, December 26, 2012
Introduction  

This is the second part of the ZeroMQ via C#. Other parts are:  

ZeroMQ via C#: Introduction 

In this article we will talk about the two types of messages that ZeroMQ can send or receive and how to format these messages using JSON. We will also learn the polling mechanism and how to use it. Finally, we will explore the synchronized PUB-SUB pattern with an example.   

ZeroMQ messages  

ZeroMQ sockets can send or receive either a single-part or a multi-part message.

Single-part Message 

A single-part message is a message that has one frame. A frame is an array of bytes. The length of a frame can be zero upwards. Frames also called "message parts" in ZeroMQ reference manual. 

For example, the messages that we sent/received in the previous article were all single-part messages type. We have used strings during sending receiving operations (a string is an array of bytes). 

We can use the following methods (found in clrzmq.dll library) to send or receive a single-part message (single-frame message):  

Send\Receive 
SendFrame\ReceiveFrame 

Multi-part Messages 

A multi-part message is a message that has more than one frame. ZeroMQ sends this message as a single on-the-wire message and guarantees to deliver all the message parts (one or more), or none of them. 

Inline image 2

Read more: Codeproject
QR: Inline image 1

Posted via email from Jasper-net

0 comments: