C# Class NetMQ.Zyre.Zyre

zyre - API wrapping one Zyre node
Inheritance: IDisposable
Exibir arquivo Open project: NetMQ/Zyre Class Usage Examples

Public Methods

Method Description
Dispose ( ) : void

Release any contained resources.

Dump ( ) : void

Tell the ZyreNode to do its Dump() routine to the _defaultLogger (if there is one).

EndPoint ( ) : string

Return our node endpoint, after successful initialization.

Join ( string groupName ) : void

Join a named group; after joining a group you can send messages to the group and all Zyre nodes in that group will receive them.

Leave ( string groupName ) : void

Leave a group.

Name ( ) : string

Return our node name, after successful initialization. By default is taken from the UUID and shortened.

OwnGroups ( ) : List

Return list of currently joined groups.

PeerAddress ( System.Guid peer ) : string

Return the endpoint of a connected peer.

PeerGroups ( ) : List

Return list of groups known through connected peers. The list includes every peer group ever seen by this instance. The list can grow but it can never shrink.

PeerHeaderValue ( System.Guid peer, string key ) : string

Return the value of a header of a connected peer. Returns String.Empty if peer or key doesn't exist.

Peers ( ) : List

Return list of current peers (their Uuids).

Receive ( ) : NetMQMessage

Receive next message from network; the message may be a control. message (ENTER, EXIT, JOIN, LEAVE, STOP, EVASIVE) or data (WHISPER, SHOUT).

SetHeader ( string key, string format ) : void

Set node header; these are provided to other nodes during discovery and come in each ENTER message.

SetInterface ( string value ) : void

Set network interface for UDP beacons. If you do not set this, NetMQ will choose an interface for you. On boxes with several interfaces you should specify which one you want to use, or strange things can happen. This will only apply to the next START command.

SetInterval ( System.TimeSpan interval ) : void

Set UDP beacon discovery interval. Default is instant beacon exploration followed by pinging every 1,000 milliseconds.

SetName ( string name ) : void

Set Name (the public name of this node)

SetPort ( int port ) : void

Set UDP beacon discovery port; defaults to 5670, this call overrides that so you can create independent clusters on the same network, for e.g. development vs. production. Has no effect after Zyre.Start().

Shout ( string groupName, NetMQMessage message ) : void

Send message to a named group.

Shouts ( string groupName, string format ) : void

Start ( ) : void

Start node, after setting header values. When you start a node it begins discovery and connection.

Stop ( ) : void

Stop node; this signals to other peers that this node will go away. This is polite; however you can also just destroy the node without stopping it.

ToString ( ) : string
Uuid ( ) : System.Guid

Return our node UUID string, after successful initialization

Version ( int &major, int &minor, int &patch ) : void

Return the Zyre version for run-time API detection

Whisper ( System.Guid peer, NetMQMessage message ) : void

Send message to single peer.

Whispers ( System.Guid peer, string format ) : void

Zyre ( string name, bool useEvents = true, Action loggerDelegate = null ) : System

Create a Zyre API that communicates with a node on the ZRE bus.

Protected Methods

Method Description
Dispose ( bool disposing ) : void

Release any contained resources.

Private Methods

Method Description
InboxReceiveReady ( object sender, NetMQSocketEventArgs e ) : void

This receives a message relayed by ZyreNode.ReceivePeer()

OnEnterEvent ( ZyreEventEnter enterEvent ) : void
OnEvasiveEvent ( ZyreEventEvasive evasiveEvent ) : void
OnExitEvent ( ZyreEventExit exitEvent ) : void
OnJoinEvent ( ZyreEventJoin joinEvent ) : void
OnLeaveEvent ( ZyreEventLeave leaveEvent ) : void
OnShoutEvent ( ZyreEventShout shoutEvent ) : void
OnStopEvent ( ZyreEventStop stopEvent ) : void
OnWhisperEvent ( ZyreEventWhisper whisperEvent ) : void

Method Details

Dispose() public method

Release any contained resources.
public Dispose ( ) : void
return void

Dispose() protected method

Release any contained resources.
protected Dispose ( bool disposing ) : void
disposing bool true if managed resources are to be released
return void

Dump() public method

Tell the ZyreNode to do its Dump() routine to the _defaultLogger (if there is one).
public Dump ( ) : void
return void

EndPoint() public method

Return our node endpoint, after successful initialization.
public EndPoint ( ) : string
return string

Join() public method

Join a named group; after joining a group you can send messages to the group and all Zyre nodes in that group will receive them.
public Join ( string groupName ) : void
groupName string the name of the group
return void

Leave() public method

Leave a group.
public Leave ( string groupName ) : void
groupName string the name of the group
return void

Name() public method

Return our node name, after successful initialization. By default is taken from the UUID and shortened.
public Name ( ) : string
return string

OwnGroups() public method

Return list of currently joined groups.
public OwnGroups ( ) : List
return List

PeerAddress() public method

Return the endpoint of a connected peer.
public PeerAddress ( System.Guid peer ) : string
peer System.Guid The peer identity
return string

PeerGroups() public method

Return list of groups known through connected peers. The list includes every peer group ever seen by this instance. The list can grow but it can never shrink.
public PeerGroups ( ) : List
return List

PeerHeaderValue() public method

Return the value of a header of a connected peer. Returns String.Empty if peer or key doesn't exist.
public PeerHeaderValue ( System.Guid peer, string key ) : string
peer System.Guid The Guid for the peer whose header value we want
key string The key whose header value we want
return string

Peers() public method

Return list of current peers (their Uuids).
public Peers ( ) : List
return List

Receive() public method

Receive next message from network; the message may be a control. message (ENTER, EXIT, JOIN, LEAVE, STOP, EVASIVE) or data (WHISPER, SHOUT).
public Receive ( ) : NetMQMessage
return NetMQMessage

SetHeader() public method

Set node header; these are provided to other nodes during discovery and come in each ENTER message.
public SetHeader ( string key, string format ) : void
key string the key
format string the format string for the value
return void

SetInterface() public method

Set network interface for UDP beacons. If you do not set this, NetMQ will choose an interface for you. On boxes with several interfaces you should specify which one you want to use, or strange things can happen. This will only apply to the next START command.
public SetInterface ( string value ) : void
value string the interface. A null or empty string means to use the default interface
return void

SetInterval() public method

Set UDP beacon discovery interval. Default is instant beacon exploration followed by pinging every 1,000 milliseconds.
public SetInterval ( System.TimeSpan interval ) : void
interval System.TimeSpan beacon discovery interval
return void

SetName() public method

Set Name (the public name of this node)
public SetName ( string name ) : void
name string the name to set
return void

SetPort() public method

Set UDP beacon discovery port; defaults to 5670, this call overrides that so you can create independent clusters on the same network, for e.g. development vs. production. Has no effect after Zyre.Start().
public SetPort ( int port ) : void
port int the UDP beacon discovery port override
return void

Shout() public method

Send message to a named group.
public Shout ( string groupName, NetMQMessage message ) : void
groupName string
message NetMQMessage
return void

Shouts() public method

public Shouts ( string groupName, string format ) : void
groupName string
format string the format string for the value
return void

Start() public method

Start node, after setting header values. When you start a node it begins discovery and connection.
public Start ( ) : void
return void

Stop() public method

Stop node; this signals to other peers that this node will go away. This is polite; however you can also just destroy the node without stopping it.
public Stop ( ) : void
return void

ToString() public method

public ToString ( ) : string
return string

Uuid() public method

Return our node UUID string, after successful initialization
public Uuid ( ) : System.Guid
return System.Guid

Version() public method

Return the Zyre version for run-time API detection
public Version ( int &major, int &minor, int &patch ) : void
major int major version
minor int minor version
patch int patch number
return void

Whisper() public method

Send message to single peer.
public Whisper ( System.Guid peer, NetMQMessage message ) : void
peer System.Guid the peer who gets the message
message NetMQMessage the message
return void

Whispers() public method

public Whispers ( System.Guid peer, string format ) : void
peer System.Guid the peer who gets the message
format string the format string for the value
return void

Zyre() public method

Create a Zyre API that communicates with a node on the ZRE bus.
public Zyre ( string name, bool useEvents = true, Action loggerDelegate = null ) : System
name string The name of the node
useEvents bool Set this to true to disable Receive() and instead subscribe to events for getting messages from peers. Default is true.
loggerDelegate Action An action to take for logging when _verbose is true. Default is null.
return System