View Source Rambla.Handlers.S3 (Rambla v1.2.6)
Default handler for _S3 connections. For this handler to work properly, one must configure it with
# config :ex_aws,
# access_key_id: [{:system, "AWS_ACCESS_KEY_ID"}, {:awscli, "default", 30}, :instance_role],
# secret_access_key: [{:system, "AWS_SECRET_ACCESS_KEY"}, {:awscli, "default", 30}, :instance_role]
config :ex_aws,
access_key_id: [{:system, "AWS_ACCESS_KEY_ID"}, :instance_role],
secret_access_key: [{:system, "AWS_SECRET_ACCESS_KEY"}, :instance_role],
hackney_opts: [follow_redirect: true, recv_timeout: 30_000],
region: {:system, "AWS_REGION"},
json_codec: Jason,
normalize_path: false,
retries: [
max_attempts: 1,
base_backoff_in_ms: 10,
max_backoff_in_ms: 10_000
]
config :rambla, :s3,
connections: [
bucket_1: [bucket: "test-bucket", path: ""]
],
channels: [
chan_1: [
connection: :bucket_1,
options: [connector: ExAws]
]
]
# Then you can access the connection/channel via `Rambla.Handlers.S3` as
Rambla.Handlers.S3.publish(:chan_1, %{message: "Hi John!", connector: Rambla.Mocks.ExAws})
Summary
Functions
The list of child_spec
returned
to be embedded into a supervision tree.
An interface to publish messages using the FSM pool.
The entry point: this would start a supervisor with all the pools and stuff
Functions
The list of child_spec
returned
to be embedded into a supervision tree.
Known options:
connection_options
— akeyword()
or a function of arity one, which is to receive channel names and return connection options as a listcount
— the number of workers in the poolchild_opts
— the options to be passed to the worker’s spec (you won’t need those)
Example
Rambla.Handlers.Redis.children_specs(
connection_options: [exchange: "amq.direct"], count: 3)
An interface to publish messages using the FSM pool.
The id
is the specific to an implementation,
for Amqp
it’d be the channel name, for instance.
The second parameter would be a payload, or, if the backend supports it,
the function of arity one, which would receive back the connection pid
.
Example
Rambla.Handlers.Amqp.publish :channel_name, %{foo: :bar}
@spec start_link([ Supervisor.option() | Supervisor.init_option() | {:connection_options, keyword() | (term() -> keyword())} | {:count, non_neg_integer()} ]) :: Supervisor.on_start()
The entry point: this would start a supervisor with all the pools and stuff