Provides a wrapper around the Amazon Web Service Simple Notification Service.
-
Include this dependency:
// For Lift 2.5.x (Scala 2.9 and 2.10): "net.liftmodules" %% "aws-sns_2.5" % "1.0.2" // For Lift 2.6.x (Scala 2.10 and 2.11): "net.liftmodules" %% "aws-sns_2.6" % "1.1.0" // For Lift 3.0 (Scala 2.11): "net.liftmodules" %% "aws-sns_3.0" % "1.1.0-SNAPSHOT"
-
Configure your connection:
You need to supply:
- AWS access key and secret.
- the topic ARN you have configured in the AWS management console, and region.
- the path in your Lift app you want to register for receiving notifications.
- the public host port and protocol of your Lift app.
In
Boot.scala
:val config = SNSConfig( AWSCreds("accessKey", "secret"), "arn:aws:sns:us-east-1:something:topic", "sns" :: Nil, "66.123.45.678", 9090, Protocol.HTTP, "us-east-1" )
-
Register a handler and initialise in
Boot.scala
:val sns = SNS(config) { case s => println(s"GOT $s") } sns.init
Your handler function will be passed the Message
field value from the JSON suppled by SNS.
-
Publish notifications:
sns ! Publish("my message")
Uses SBT 0.13
In your build.sbt
:
port in container.Configuration := 9090
Or temporarily from the shell:
sbt> port in container.Configuration := 9090
Yeah, you should definitely do that, rather than use your AWS account login.