ExAwsConfigurator.SNS (ExAwsConfigurator v1.4.1) View Source

Link to this section Summary

Functions

Create an sns topic, based on ex_aws_configurator configuration

Publish an message to a topic based on clan configuration

Link to this section Functions

Link to this function

create_topic(topic_name)

View Source

Specs

create_topic(atom()) :: {:ok, term()} | {:error, term()}

Create an sns topic, based on ex_aws_configurator configuration

raises ExAwsConfigurator.NoResultsError if no configuration was found.

for the example below, we will consider the following settings

# config/config.exs

config :ex_aws_configurator,
  ...
  topics: %{
    an_topic: %{
      region: "us-east-1",
      prefix: "topic_prefix",
      environment: "environment"
    }
  }

Examples

ExAwsConfigurator.create_topic(:an_topic)
#=> {:ok, term()}

will create a topic named prefix + environment + map_key, the result will be topic_prefix_environment_an_topic on region us-east-1

the response term() will be the ExAws response without any modification

ExAwsConfigurator.get_queue(:not_exist)
#=> ** (ExAwsConfigurator.NoResultsError) the configuration for queue not_exist is not set
Link to this function

publish(topic_name, message)

View Source

Specs

publish(atom(), map()) :: {:ok, term()} | {:error, term()}

Publish an message to a topic based on clan configuration