FairMQChannel Class Reference

## Classes

struct | ChannelConfigurationError

## Public Member Functions

| FairMQChannel ()
| Default constructor.
| FairMQChannel (const std::string &type, const std::string &method, const std::string &address)
| FairMQChannel (const std::string &name, const std::string &type, std::shared_ptr< FairMQTransportFactory > factory)
| FairMQChannel (const std::string &name, const std::string &type, const std::string &method, const std::string &address, std::shared_ptr< FairMQTransportFactory > factory)
| FairMQChannel (const FairMQChannel &)
| Copy Constructor.
FairMQChannel & | operator= (const FairMQChannel &)
| Assignment operator.
virtual | ~FairMQChannel ()
| Default destructor.
FairMQSocket & | GetSocket () const
bool | Bind (const std::string &address)
bool | Connect (const std::string &address)
std::string | GetChannelName () const
std::string | GetName () const
std::string | GetChannelPrefix () const
std::string | GetPrefix () const
std::string | GetChannelIndex () const
std::string | GetIndex () const
std::string | GetType () const
std::string | GetMethod () const
std::string | GetAddress () const
std::string | GetTransportName () const
int | GetSndBufSize () const
int | GetRcvBufSize () const
int | GetSndKernelSize () const
int | GetRcvKernelSize () const
int | GetLinger () const
int | GetRateLogging () const
int | GetPortRangeMin () const
int | GetPortRangeMax () const
bool | GetAutoBind () const
void | UpdateType (const std::string &type)
void | UpdateMethod (const std::string &method)
void | UpdateAddress (const std::string &address)
void | UpdateTransport (const std::string &transport)
void | UpdateSndBufSize (const int sndBufSize)
void | UpdateRcvBufSize (const int rcvBufSize)
void | UpdateSndKernelSize (const int sndKernelSize)
void | UpdateRcvKernelSize (const int rcvKernelSize)
void | UpdateLinger (const int duration)
void | UpdateRateLogging (const int rateLogging)
void | UpdatePortRangeMin (const int minPort)
void | UpdatePortRangeMax (const int maxPort)
void | UpdateAutoBind (const bool autobind)
void | UpdateChannelName (const std::string &name)
void | UpdateName (const std::string &name)
bool | IsValid () const
bool | ValidateChannel ()
bool | Validate ()
void | Init ()
bool | ConnectEndpoint (const std::string &endpoint)
bool | BindEndpoint (std::string &endpoint)
void | ResetChannel ()
| Resets the channel (requires validation to be used again).
int | Send (FairMQMessagePtr &msg, int sndTimeoutInMs=-1)
int | Receive (FairMQMessagePtr &msg, int rcvTimeoutInMs=-1)
int | SendAsync (FairMQMessagePtr &msg) __attribute__((deprecated("For non-blocking Send
return fSocket | Send (msg, 0)
int | ReceiveAsync (FairMQMessagePtr &msg) __attribute__((deprecated("For non-blocking Receive
return fSocket | Receive (msg, 0)
int64_t | Send (std::vector< FairMQMessagePtr > &msgVec, int sndTimeoutInMs=-1)
int64_t | Receive (std::vector< FairMQMessagePtr > &msgVec, int rcvTimeoutInMs=-1)
int64_t | SendAsync (std::vector< FairMQMessagePtr > &msgVec) __attribute__((deprecated("For non-blocking Send
return fSocket | Send (msgVec, 0)
int64_t | ReceiveAsync (std::vector< FairMQMessagePtr > &msgVec) __attribute__((deprecated("For non-blocking Receive
return fSocket | Receive (msgVec, 0)
int64_t | Send (FairMQParts &parts, int sndTimeoutInMs=-1)
int64_t | Receive (FairMQParts &parts, int rcvTimeoutInMs=-1)
int64_t | SendAsync (FairMQParts &parts) __attribute__((deprecated("For non-blocking Send
int64_t | ReceiveAsync (FairMQParts &parts) __attribute__((deprecated("For non-blocking Receive
unsigned long | GetBytesTx () const
unsigned long | GetBytesRx () const
unsigned long | GetMessagesTx () const
unsigned long | GetMessagesRx () const
auto | Transport () -> FairMQTransportFactory *
template<typename... Args>
FairMQMessagePtr | NewMessage (Args &&... args)
template<typename T >
FairMQMessagePtr | NewSimpleMessage (const T &data)
template<typename T >
FairMQMessagePtr | NewStaticMessage (const T &data)

## Public Attributes

int use timeout version with timeout | of: Send(msg
int use timeout version with timeout | timeout
int64_t use timeout version with timeout | of: Send(msgVec
int64_t use timeout version with timeout | timeout

## Friends

class | FairMQDevice

## Constructor & Destructor Documentation

## FairMQChannel() [1/3]

FairMQChannel::FairMQChannel | ( | const std::string & | type,
|  | const std::string & | method,
|  | const std::string & | address
| ) |  |

Constructor

Parameters

  type | Socket type (push/pull/pub/sub/spub/xsub/pair/req/rep/dealer/router/)
  method | Socket method (bind/connect)
  address | Network address to bind/connect to (e.g. "tcp://127.0.0.1:5555" or "ipc://abc")

## FairMQChannel() [2/3]

FairMQChannel::FairMQChannel | ( | const std::string & | name,
|  | const std::string & | type,
|  | std::shared_ptr< FairMQTransportFactory > | factory
| ) |  |

Constructor

Parameters

  name | Channel name
  type | Socket type (push/pull/pub/sub/spub/xsub/pair/req/rep/dealer/router/)
  factory | TransportFactory

## FairMQChannel() [3/3]

FairMQChannel::FairMQChannel | ( | const std::string & | name,
|  | const std::string & | type,
|  | const std::string & | method,
|  | const std::string & | address,
|  | std::shared_ptr< FairMQTransportFactory > | factory
| ) |  |

Constructor

Parameters

  name | Channel name
  type | Socket type (push/pull/pub/sub/spub/xsub/pair/req/rep/dealer/router/)
  method | Socket method (bind/connect)
  address | Network address to bind/connect to (e.g. "tcp://127.0.0.1:5555" or "ipc://abc")
  factory | TransportFactory

## Member Function Documentation

## GetAddress()

string FairMQChannel::GetAddress | ( |  | ) | const

Get socket address (e.g. "tcp://127.0.0.1:5555" or "ipc://abc")

Returns
  Returns socket address (e.g. "tcp://127.0.0.1:5555" or "ipc://abc")

## GetAutoBind()

bool FairMQChannel::GetAutoBind | ( |  | ) | const

Set automatic binding (pick random port if bind fails)

Returns
  true/false, true if automatic binding is enabled

## GetChannelIndex()

std::string FairMQChannel::GetChannelIndex | ( |  | ) | const

inline

Get channel index

Returns
  Returns channel index (e.g. 0 in "data[0]")

## GetChannelName()

std::string FairMQChannel::GetChannelName | ( |  | ) | const

inline

Get channel name

Returns
  Returns full channel name (e.g. "data[0]")

## GetChannelPrefix()

std::string FairMQChannel::GetChannelPrefix | ( |  | ) | const

inline

Get channel prefix

Returns
  Returns channel prefix (e.g. "data" in "data[0]")

## GetLinger()

int FairMQChannel::GetLinger | ( |  | ) | const

Get linger duration (in milliseconds)

Returns
  Returns linger duration (in milliseconds)

## GetMethod()

string FairMQChannel::GetMethod | ( |  | ) | const

Get socket method

Returns
  Returns socket method (bind/connect)

## GetPortRangeMax()

int FairMQChannel::GetPortRangeMax | ( |  | ) | const

Get end of the port range for automatic binding

Returns
  end of the port range

## GetPortRangeMin()

int FairMQChannel::GetPortRangeMin | ( |  | ) | const

Get start of the port range for automatic binding

Returns
  start of the port range

## GetRateLogging()

int FairMQChannel::GetRateLogging | ( |  | ) | const

Get socket rate logging interval (in seconds)

Returns
  Returns socket rate logging interval (in seconds)

## GetRcvBufSize()

int FairMQChannel::GetRcvBufSize | ( |  | ) | const

Get socket receive buffer size (in number of messages)

Returns
  Returns socket receive buffer size (in number of messages)

## GetRcvKernelSize()

int FairMQChannel::GetRcvKernelSize | ( |  | ) | const

Get socket kernel transmit receive buffer size (in bytes)

Returns
  Returns socket kernel transmit receive buffer size (in bytes)

## GetSndBufSize()

int FairMQChannel::GetSndBufSize | ( |  | ) | const

Get socket send buffer size (in number of messages)

Returns
  Returns socket send buffer size (in number of messages)

## GetSndKernelSize()

int FairMQChannel::GetSndKernelSize | ( |  | ) | const

Get socket kernel transmit send buffer size (in bytes)

Returns
  Returns socket kernel transmit send buffer size (in bytes)

## GetTransportName()

string FairMQChannel::GetTransportName | ( |  | ) | const

Get channel transport ("default", "zeromq", "nanomsg" or "shmem")

Returns
  Returns channel transport (e.g. "default", "zeromq", "nanomsg" or "shmem")

## GetType()

string FairMQChannel::GetType | ( |  | ) | const

Get socket type

Returns
  Returns socket type (push/pull/pub/sub/spub/xsub/pair/req/rep/dealer/router/)

## IsValid()

bool FairMQChannel::IsValid | ( |  | ) | const

Checks if the configured channel settings are valid (checks the validity parameter, without running full validation (as oposed to ValidateChannel()))

Returns
  true if channel settings are valid, false otherwise.

## Receive() [1/3]

int FairMQChannel::Receive | ( | FairMQMessagePtr & | msg,
|  | int | rcvTimeoutInMs = `-1`
| ) |  |

inline

Receives a message from the socket queue.

Parameters

  msg | Constant reference of unique_ptr to a FairMQMessage
  rcvTimeoutInMs | receive timeout in ms. -1 will wait forever (or until interrupt (e.g. via state change)), 0 will not wait (return immediately if cannot receive)

Returns
  Number of bytes that have been received. -2 if reading from the queue was not possible or timed out. -1 if there was an error.

## Receive() [2/3]

int64_t FairMQChannel::Receive | ( | std::vector< FairMQMessagePtr > & | msgVec,
|  | int | rcvTimeoutInMs = `-1`
| ) |  |

inline

Receive a vector of messages

Parameters

  msgVec | message vector reference
  rcvTimeoutInMs | receive timeout in ms. -1 will wait forever (or until interrupt (e.g. via state change)), 0 will not wait (return immediately if cannot receive)

Returns
  Number of bytes that have been received. -2 if reading from the queue was not possible or timed out. -1 if there was an error.

## Receive() [3/3]

int64_t FairMQChannel::Receive | ( | FairMQParts & | parts,
|  | int | rcvTimeoutInMs = `-1`
| ) |  |

inline

Receive FairMQParts

Parameters

  parts | FairMQParts reference
  rcvTimeoutInMs | receive timeout in ms. -1 will wait forever (or until interrupt (e.g. via state change)), 0 will not wait (return immediately if cannot receive)

Returns
  Number of bytes that have been received. -2 if reading from the queue was not possible or timed out. -1 if there was an error.

## Send() [1/3]

int FairMQChannel::Send | ( | FairMQMessagePtr & | msg,
|  | int | sndTimeoutInMs = `-1`
| ) |  |

inline

Sends a message to the socket queue.

Parameters

  msg | Constant reference of unique_ptr to a FairMQMessage
  sndTimeoutInMs | send timeout in ms. -1 will wait forever (or until interrupt (e.g. via state change)), 0 will not wait (return immediately if cannot send)

Returns
  Number of bytes that have been queued. -2 If queueing was not possible or timed out. -1 if there was an error.

## Send() [2/3]

int64_t FairMQChannel::Send | ( | std::vector< FairMQMessagePtr > & | msgVec,
|  | int | sndTimeoutInMs = `-1`
| ) |  |

inline

Send a vector of messages

Parameters

  msgVec | message vector reference
  sndTimeoutInMs | send timeout in ms. -1 will wait forever (or until interrupt (e.g. via state change)), 0 will not wait (return immediately if cannot send)

Returns
  Number of bytes that have been queued. -2 If queueing was not possible or timed out. -1 if there was an error.

## Send() [3/3]

int64_t FairMQChannel::Send | ( | FairMQParts & | parts,
|  | int | sndTimeoutInMs = `-1`
| ) |  |

inline

Send FairMQParts

Parameters

  parts | FairMQParts reference
  sndTimeoutInMs | send timeout in ms. -1 will wait forever (or until interrupt (e.g. via state change)), 0 will not wait (return immediately if cannot send)

Returns
  Number of bytes that have been queued. -2 If queueing was not possible or timed out. -1 if there was an error.

## UpdateAddress()

void FairMQChannel::UpdateAddress | ( | const std::string & | address | ) |

Set socket address

Parameters

  Socket | address (e.g. "tcp://127.0.0.1:5555" or "ipc://abc")

## UpdateAutoBind()

void FairMQChannel::UpdateAutoBind | ( | const bool | autobind | ) |

Set automatic binding (pick random port if bind fails)

Parameters

  autobind | true/false, true to enable automatic binding

## UpdateChannelName()

void FairMQChannel::UpdateChannelName | ( | const std::string & | name | ) |

inline

Set channel name

Parameters

  name | Arbitrary channel name

## UpdateLinger()

void FairMQChannel::UpdateLinger | ( | const int | duration | ) |

Set linger duration (in milliseconds)

Parameters

  duration | linger duration (in milliseconds)

## UpdateMethod()

void FairMQChannel::UpdateMethod | ( | const std::string & | method | ) |

Set socket method

Parameters

  method | Socket method (bind/connect)

## UpdatePortRangeMax()

void FairMQChannel::UpdatePortRangeMax | ( | const int | maxPort | ) |

Set end of the port range for automatic binding

Parameters

  maxPort | end of the port range

## UpdatePortRangeMin()

void FairMQChannel::UpdatePortRangeMin | ( | const int | minPort | ) |

Set start of the port range for automatic binding

Parameters

  minPort | start of the port range

## UpdateRateLogging()

void FairMQChannel::UpdateRateLogging | ( | const int | rateLogging | ) |

Set socket rate logging interval (in seconds)

Parameters

  rateLogging | Socket rate logging interval (in seconds)

## UpdateRcvBufSize()

void FairMQChannel::UpdateRcvBufSize | ( | const int | rcvBufSize | ) |

Set socket receive buffer size

Parameters

  rcvBufSize | Socket receive buffer size (in number of messages)

## UpdateRcvKernelSize()

void FairMQChannel::UpdateRcvKernelSize | ( | const int | rcvKernelSize | ) |

Set socket kernel transmit receive buffer size (in bytes)

Parameters

  rcvKernelSize | Socket receive buffer size (in bytes)

## UpdateSndBufSize()

void FairMQChannel::UpdateSndBufSize | ( | const int | sndBufSize | ) |

Set socket send buffer size

Parameters

  sndBufSize | Socket send buffer size (in number of messages)

## UpdateSndKernelSize()

void FairMQChannel::UpdateSndKernelSize | ( | const int | sndKernelSize | ) |

Set socket kernel transmit send buffer size (in bytes)

Parameters

  sndKernelSize | Socket send buffer size (in bytes)

## UpdateTransport()

void FairMQChannel::UpdateTransport | ( | const std::string & | transport | ) |

Set channel transport

Parameters

  transport | transport string ("default", "zeromq", "nanomsg" or "shmem")

## UpdateType()

void FairMQChannel::UpdateType | ( | const std::string & | type | ) |

Set socket type

Parameters

  type | Socket type (push/pull/pub/sub/spub/xsub/pair/req/rep/dealer/router/)

## Validate()

bool FairMQChannel::Validate | ( |  | ) |

Validates channel configuration

Returns
  true if channel settings are valid, false otherwise.

## ValidateChannel()

bool FairMQChannel::ValidateChannel | ( |  | ) |

inline

Validates channel configuration

Returns
  true if channel settings are valid, false otherwise.

The documentation for this class was generated from the following files:

- fairmq/FairMQChannel.h
- fairmq/FairMQChannel.cxx

privacy