Skip to content

conduitframework/conduit_mqtt_example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ConduitMQTTExample

Example App that uses Conduit and ConduitMQTT.

Running

You'll need an MQTT broker running locally. The default port 1883. An easy way to do that is using docker, like so:

docker run -p 1883:1883 -e "DOCKER_VERNEMQ_ALLOW_ANONYMOUS=on" -e "DOCKER_VERNEMQ_log.console.level=debug" -it erlio/docker-vernemq:1.5.0

You can run the project by doing:

iex -S mix run

You should see logs mentioning that it has created the message queue at startup.

22:28:46.712 [info]  MQTT Adapter started!

Once you have an iex prompt, you can send a message by doing:

import Conduit.Message
alias Conduit.Message
alias ConduitMQTTExample.Broker

message = put_body(%Message{}, %{"my" => "message"})

Broker.publish(:message_out, message)

About

Example app for conduit MQTT adapter

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages