tortoise v0.10.0 Tortoise.Pipe View Source

Experimental. This feature is under development.

The transmitter “pipe”, for lack of a better word, is an opaque data type that can be given to a process. It contains amongst other things a socket.

A process can obtain a transmitter pipe by issuing a pipe = Tortoise.Pipe.new(client_id) request, which will result in a pipe in passive mode, meaning it will hold a socket it can publish messages into, but might fail, in which case it will attempt to get another socket from the transmitter. This all happens behind the scenes, it is important though that the returned pipe is used in future pipe requests, so publishing on a pipe should look like this:

pipe = Tortoise.Pipe.publish(pipe, “foo/bar”, “bonjour !”)

This is all experimental, and efforts to document this better will be made when the design and implementation has stabilized.

Link to this section Summary

Functions

Await for acknowledge messages for the currently pending messages

Create a new publisher pipe

Publish a message using a pipe

Link to this section Types

Link to this section Functions

Link to this function await(pipe, timeout \\ 5000) View Source

Await for acknowledge messages for the currently pending messages.

Note that this enters a selective receive loop, so the await needs to happen before the process reaches its mailbox. It can be used in situations where we want to send a couple of messages and continue when the server has received them; This only works for messages with a Quality of Service above 0.

Link to this function new(client_id, opts \\ []) View Source

Create a new publisher pipe.

Link to this function publish(pipe, topic, payload \\ nil, opts \\ []) View Source

Publish a message using a pipe.