@@ -5,6 +5,45 @@ The main benefit of this library is working with Scala-native Futures when
55interacting with KPL.
66
77
8+ ## Installation
9+
10+ ```
11+ resolvers in ThisBuild += Resolver.bintrayRepo("streetcontxt", "maven")
12+ libraryDependencies += "com.contxt" %% "kpl-scala" % "1.0.4"
13+ ```
14+
15+
16+ ## Usage
17+
18+ Here is a simple app that initializes the Kinesis producer and sends a string message.
19+
20+ ```
21+ import com.amazonaws.auth.DefaultAWSCredentialsProviderChain
22+ import com.amazonaws.services.kinesis.producer.KinesisProducerConfiguration
23+ import com.contxt.kinesis.ScalaKinesisProducer
24+ import java.nio.ByteBuffer
25+ import scala.concurrent.Await
26+ import scala.concurrent.duration._
27+
28+ object Main {
29+ def main(args: Array[String]): Unit = {
30+ val producerConfig = new KinesisProducerConfiguration()
31+ .setCredentialsProvider(new DefaultAWSCredentialsProviderChain)
32+ .setRegion("us-east-1")
33+
34+ val producer = ScalaKinesisProducer("myStream", producerConfig)
35+
36+ val sendFuture = producer.send(
37+ partitionKey = "myKey",
38+ data = ByteBuffer.wrap("myMessage".getBytes("UTF-8"))
39+ )
40+ Await.result(sendFuture, 10.seconds)
41+ Await.result(producer.shutdown(), Duration.Inf)
42+ }
43+ }
44+ ```
45+
46+
847## Amazon Licensing Restrictions
948** KPL license is not compatible with open source licenses!** See
1049[ this discussion] ( https://issues.apache.org/jira/browse/LEGAL-198 ) for more details.
0 commit comments