Alternera.Plugins.AnypointMq.Broker (alternera_plugin_anypoint_mq v0.9.0)

Copy Markdown View Source

The calls an Anypoint MQ step makes to the broker's REST API, for Alternera.Plugins.AnypointMq. Every path is under <broker_url>/organizations/<org>/environments/<env>/destinations/<destination>:

  • publish: PUT …/messages/<message id>, a JSON body of headers (messageId, messageGroupId, deliveryDelay), properties and body, answered 201;
  • consume: GET …/messages?pollingTime=…&batchSize=…&lockTtl=…, answered 200 with a JSON array of messages or 204 with none; with immediate acks, DELETE …/messages with [{messageId, lockId}];
  • ack: DELETE …/messages/<message id> with {"lockId": …};
  • nack: DELETE …/messages/<message id>/locks/<lock id>.

An ack's or nack's answer carries status, "successful" or "failure".

Each call goes out through Plugin.Provisional.Outbound as the step's proxy user, with the Authorization the tenant's auth profile for its URL gives (Plugin.Provisional.Credentials.for_call/3), its recording redacted; a 401 drops that token and calls once more with a new one. The calls end call_reserve_ms/1 before the step's own time, so a slow broker fails the step timeout with its call recorded rather than the runner stopping it.

Summary

Functions

How long before the step's time is up its calls must be done.

url as a broker URL (Wire.check_url/1).

The fingerprint of a resolved call: the operation, method, URL (a publish's generated id and a consume's polling time, which change from run to run, left out), body and proxy user, so a dry run and the real run of the same call agree.

Runs the step's operation: call/3's result.

What a preview says the step would do: the call, as whom and its fingerprint, with nothing sent. A setting that does not resolve is named in place of the call.

Functions

call_reserve_ms(time_left_ms)

@spec call_reserve_ms(non_neg_integer()) :: non_neg_integer()

How long before the step's time is up its calls must be done.

check_url(url)

@spec check_url(String.t()) :: {:ok, String.t()} | {:error, String.t()}

url as a broker URL (Wire.check_url/1).

fingerprint(call, opts)

@spec fingerprint(map(), map()) :: String.t()

The fingerprint of a resolved call: the operation, method, URL (a publish's generated id and a consume's polling time, which change from run to run, left out), body and proxy user, so a dry run and the real run of the same call agree.

run(inputs, opts, context)

@spec run(Alternera.Plugin.Inputs.t(), map(), map()) :: tuple()

Runs the step's operation: call/3's result.

would_call(inputs, opts, context)

@spec would_call(Alternera.Plugin.Inputs.t(), map(), map()) :: map()

What a preview says the step would do: the call, as whom and its fingerprint, with nothing sent. A setting that does not resolve is named in place of the call.