Skip to content

Instantly share code, notes, and snippets.

@akhilvijayan05
Created October 13, 2018 11:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akhilvijayan05/07d2f2a3968d8ba706b6be8fff2f0127 to your computer and use it in GitHub Desktop.
Save akhilvijayan05/07d2f2a3968d8ba706b6be8fff2f0127 to your computer and use it in GitHub Desktop.
A simple AMPS publisher example
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