View Source mqtt_sessions_router (mqtt_sessions v2.6.0)

Process owning the MQTT topic router.

Summary

Types

-type mqtt_msg() ::
    #{pool => atom(),
      topic => [binary()],
      topic_bindings => [proplists:property()],
      message => mqtt_packet_map:mqtt_packet(),
      publisher_context => term(),
      subscriber_context => term(),
      no_local => boolean(),
      qos => 0 | 1 | 2,
      retain_as_published => boolean(),
      retain_handling => integer()}.
-type subscriber() :: {pid() | mfa(), OwnerPid :: pid(), subscriber_options()}.
-type subscriber_options() ::
    #{subscriber_context => term(),
      no_local => boolean(),
      qos => 0 | 1 | 2,
      retain_as_published => boolean(),
      retain_handling => integer()}.

Functions

Link to this function

code_change(Vsn, State, Extra)

View Source
Link to this function

handle_call(Cmd, From, State)

View Source
Link to this function

handle_info(Info, State)

View Source
-spec info(atom()) -> list().
-spec init([atom()]) -> {ok, #state{pool :: atom(), router :: router:router(), monitors :: map()}}.
-spec name(atom()) -> atom().
Link to this function

publish(Pool, Topic, Msg)

View Source
-spec publish(atom(), list(), mqtt_packet_map:mqtt_packet()) ->
           {ok, pid() | undefined} | {error, overload}.
Link to this function

publish(Pool, Topic0, Msg, PublisherContext)

View Source
-spec publish(atom(), list(), mqtt_packet_map:mqtt_packet(), term()) ->
           {ok, pid() | undefined} | {error, overload}.
-spec start_link(atom()) -> {ok, pid()} | {error, term()}.
Link to this function

subscribe(Pool, Topic, MFA, SubscriberContext)

View Source
-spec subscribe(atom(), list(), mqtt_sessions:callback(), term()) -> ok | {error, invalid_subscriber}.
Link to this function

subscribe(Pool, TopicFilter, Subscriber, OwnerPid, Options, SubscriberContext)

View Source
Link to this function

terminate(Reason, State)

View Source
Link to this function

unsubscribe(Pool, TopicFilter, Pid)

View Source
-spec unsubscribe(atom(), list(), pid()) -> ok | {error, notfound}.
Link to this function

unsubscribe_pid(Pool, Pid)

View Source
-spec unsubscribe_pid(atom(), pid()) -> ok.