Created
October 13, 2018 11:57
-
-
Save akhilvijayan05/07d2f2a3968d8ba706b6be8fff2f0127 to your computer and use it in GitHub Desktop.
A simple AMPS publisher example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.crankuptheamps.client.Client; | |
import com.crankuptheamps.client.exception.AMPSException; | |
object Publisher extends App { | |
val client = new Client("MyClient") | |
try { | |
client.connect("tcp://127.0.0.1:9007/amps/json") | |
client.logon() | |
client.publish("messages", "{ \"message\" : \"Hello, world!\" } ") | |
} catch { | |
case ampsException: AMPSException => println(s"Caught exception: ${ampsException.getMessage}") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment