OpenAperture.Builder.Dispatcher

This module contains the logic to dispatch Builder messsages to the appropriate GenServer(s)

Summary↑

acknowledge(delivery_tag)

Method to acknowledge a message has been processed

close_connection(connection_options \\ nil)

Method to completely close a connection (and all associated subscriptions, channels, connections, etc…)

execute_milestone(arg1, arg2)

Method to finish executing the Builder request flow (successfully)

process_request(builder_request)

Method to process an incoming Builder request

publish(connection_options \\ nil, queue, payload)

Publishes a message/payload to a specific queue within the Messaging system

publish_rpc(connection_options \\ nil, queue, api, request)

Publishes a an RPC request to a specific queue within the Messaging system

register_queues()

Method to register the Builder queues with the Messaging system

reject(delivery_tag, redeliver \\ false)

Method to reject a message has been processed

start_link()

Specific start_link implementation (required by the supervisor)

subscribe(connection_options \\ nil, queue, callback_handler)

Subscribes to a specific queue within the Messaging system

unsubscribe(connection_options \\ nil, subscription_handler)

Unsubscribes to from a SubscriptionHandler in the Messaging system

Functions

acknowledge(delivery_tag)

Specs:

Method to acknowledge a message has been processed

Options

The delivery_tag option is the unique identifier of the message

close_connection(connection_options \\ nil)

Specs:

  • close_connection(OpenAperture.Messaging.ConnectionOptions.t) :: :ok | {:error, String.t}

Method to completely close a connection (and all associated subscriptions, channels, connections, etc…)

Options

The connection_options options value provides the ConnectionOptions; defaults to the @connection_options attribute

Returns

:ok | {:error, reason}

execute_milestone(arg1, arg2)

Specs:

Method to finish executing the Builder request flow (successfully)

Options

The request option defines the BuilderRequest

process_request(builder_request)

Specs:

Method to process an incoming Builder request

Options

The request option defines the BuilderRequest

publish(connection_options \\ nil, queue, payload)

Specs:

  • publish(OpenAperture.Messaging.ConnectionOptions.t, OpenAperture.Messaging.Queue.t, term) :: :ok | {:error, String.t}

Publishes a message/payload to a specific queue within the Messaging system

Options

The connection_options options value provides the ConnectionOptions; defaults to the @connection_options attribute

The queue options value provides the Queue to which to subscribe

The payload option represents the message data

Returns

:ok | {:error, reason}

publish_rpc(connection_options \\ nil, queue, api, request)

Publishes a an RPC request to a specific queue within the Messaging system

Options

The connection_options options value provides the ConnectionOptions; defaults to the @connection_options attribute

The queue options value provides the Queue to which to subscribe

The request option represents the message data

Returns

{:ok, OpenAperture.Messaging.AMQP.RpcHandler} | {:error, reason}

register_queues()

Specs:

  • register_queues :: :ok | {:error, String.t}

Method to register the Builder queues with the Messaging system

Return Value

:ok | {:error, reason}

reject(delivery_tag, redeliver \\ false)

Specs:

Method to reject a message has been processed

Options

The delivery_tag option is the unique identifier of the message

The redeliver option can be used to requeue a message

start_link()

Specs:

  • start_link :: {:ok, pid} | {:error, String.t}

Specific start_link implementation (required by the supervisor)

Options

Return Values

{:ok, pid} | {:error, reason}

subscribe(connection_options \\ nil, queue, callback_handler)

Specs:

  • subscribe(OpenAperture.Messaging.ConnectionOptions.t, OpenAperture.Messaging.Queue.t, term) :: {:ok, term} | {:error, String.t}

Subscribes to a specific queue within the Messaging system.

Options

The connection_options options value provides the ConnectionOptions; defaults to the @connection_options attribute

The queue options value provides the Queue to which to subscribe

The callback_handler option represents the method that should be called when a message is received. The handler should be a function with 2 arguments (sync), or 3 arguments (async).

Returns

for AMQP:

{:ok, subscription_handler} | {:error, reason}
unsubscribe(connection_options \\ nil, subscription_handler)

Specs:

  • unsubscribe(OpenAperture.Messaging.ConnectionOptions.t, pid) :: :ok | {:error, String.t}

Unsubscribes to from a SubscriptionHandler in the Messaging system.

Options

The connection_options options value provides the ConnectionOptions; defaults to the @connection_options attribute

The subscription_handler option represents the PID of the SubscriptionHandler

Returns

for AMQP: :ok | {:error, reason}