• Stars
    star
    184
  • Rank 205,756 (Top 5 %)
  • Language
    Scala
  • License
    Apache License 2.0
  • Created almost 10 years ago
  • Updated almost 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Reactive Streams driver for AMQP protocol. Powered by RabbitMQ library.

Reactive Streams: AMQP

Join the chat at https://gitter.im/ScalaConsultants/reactive-rabbit

Build Status

Reactive Streams driver for AMQP protocol. Powered by RabbitMQ library.

Available at Maven Central for Scala 2.11 and 2.12:

libraryDependencies += "io.scalac" %% "reactive-rabbit" % "1.1.4"

Example

Akka Streams - 2.4.12

import akka.actor.ActorSystem
import akka.stream.ActorMaterializer
import akka.stream.scaladsl.{Sink, Source}
import io.scalac.amqp.Connection


// streaming invoices to Accounting Department
val connection = Connection()
// create org.reactivestreams.Publisher
val queue = connection.consume(queue = "invoices")
// create org.reactivestreams.Subscriber
val exchange = connection.publish(exchange = "accounting_department",
  routingKey = "invoices")

implicit val system = ActorSystem()
implicit val mat = ActorMaterializer()
// Run akka-streams with queue as Source and exchange as Sink
Source.fromPublisher(queue).map(_.message).runWith(Sink.fromSubscriber(exchange))

API Docs

Run sbt doc and open target/scala-2.12/index.html.

Settings

There are 3 options for passing AMQP settings:

  • Use default settings from reference.conf and application.conf. See Config library. See refrence.conf for settings layout.
Connection()
  • Use Config programatically.
Connection(config : Config)
  • Use ConnectionSettings programatically
Connection(settings: ConnectionSettings)

ConnectionSettings have following properties:

  • addresses: Seq[Address] broker addresses (hostname/port pairs) to try in order. A random one will be picked during recovery.
  • virtualHost: String virtual host to use when connecting to the broker.
  • username: String user name to use when connecting to the broker.
  • password: String password to use when connecting to the broker.
  • heartbeat: Option[FiniteDuration] requested heartbeat interval, at least 1 second.None to disable heartbeat.
  • timeout: Duration the default connection timeout, at least 1 millisecond.
  • automaticRecovery: Boolean enable automatic connection recovery. Subscriptions are not recovered.
  • recoveryInterval: FiniteDuration how long will automatic recovery wait before attempting to reconnect.
  • ssl: Option[String] allows to use SSL for connecting to the broker. Valid values depend on JRE, see possiblities. Recent RabbitMQ servers does not allow SSL3.

Connection

Connection trait API has two groups of methods: to manage AMQP infrastructure (ie. declare and delete exchanges, queues and bindings) and to create ReactiveStreams entities: Publisher and Subscriber.
consume(queue, prefetch) - creates Delivery stream Publisher for messages from queue.
publish(exchange, routingKey) - creates Subscription that takes stream of Message that will be sent to exchange with fixed routingKey.
publish(exchange) - creates Subscription for stream of Routed (tuple of Message and routing key).

Developed by Scalac

More Repositories

1

Aspect-Based-Sentiment-Analysis

๐Ÿ’ญ Aspect-Based-Sentiment-Analysis: Transformer & Explainable ML (TensorFlow)
Python
520
star
2

panopticon-tui

Terminal UI observability and diagnostic tool for Scala applications
Rust
107
star
3

zio-scala2-quickstart.g8

A Giter8 template for a fully functional, ready to deploy ZIO-based microservice.
Scala
91
star
4

websocket-akka-http

Websocket Client/Server with akka-http
Scala
74
star
5

mesmer

OpenTelemetry agent for Scala applications
Scala
71
star
6

akka-persistence-eventsourcing

Example project with a simple REST API to a domain model persisted using akka-persistence with eventsourcing.
Scala
48
star
7

zio-slick-interop

Slick interop for ZIO
Scala
37
star
8

scala-slack-bot-core

Akka based library for writing Slack bots in Scala.
Scala
33
star
9

zio-kafka-showcase

Example project that demonstrates how to build Kafka based microservices with Scala and ZIO
Scala
31
star
10

zio-scala3-quickstart.g8

A Giter8 template for a fully functional, ready to deploy ZIO-based microservice in Scala 3.
Scala
28
star
11

zio-akka-http-interop

akka-http interop for ZIO
Scala
28
star
12

docker-postgres-cluster

Shell
27
star
13

scala-slack-bot

Scala
22
star
14

akka-periscope

Akka plugin to collect various data about actors
Scala
17
star
15

zio-dotty-quickstart.g8

A Giter8 template for a basic Dotty application build using ZIO
Scala
17
star
16

spark-kafka-avro

POC: Spark consumer for bottledwater-pg Kafka Avro topics
Scala
17
star
17

lagom-scala-post-example

Scala
11
star
18

wsug-akka-websockets

source code for Warsaw Scala Enthusiasts group meeting
Scala
8
star
19

akka-message-visualization

Proof of concept of a visualization of message flow within an Akka system
JavaScript
8
star
20

monix-blog-examples

Scala
7
star
21

akka-streams-graph-stage

Scala
7
star
22

rough-slick

Scala
6
star
23

Tezos-FullStack-Console-backend

Scala
4
star
24

scala-spark-ml

Machine learning using Spark and Scala
Scala
4
star
25

WhoSaidThat

Demo for Spark 101 post
Scala
3
star
26

Tezos-Micheline-Michelson-Translator-Frontend

TypeScript
3
star
27

akka-http-s3-upload

Experiments on different ways of uploading files to S3 using combinations of Akka HTTP directives, AWS SDK and Alpakka.
Scala
3
star
28

json-tools

Tools for JSON handling
Scala
3
star
29

macro-fun

Code accompanying the macro post, including polynomial differentiation.
Scala
3
star
30

vhs-data-analysis

Scala
2
star
31

zio-introduction

ZIO introduction workshop
Scala
2
star
32

ScalaWave2017ScalaBasic

JavaScript
2
star
33

panopticon-example

A sample Scala app, fully equipped to be monitored with https://github.com/ScalaConsultants/panopticon-tui
Scala
2
star
34

recru-app

Awesome recruitment app for the IT folks
JavaScript
2
star
35

newspaper

Scala
1
star
36

scala2-introduction

Scala 2 introduction workshop exercises
Scala
1
star
37

warsjawa-2014

Mobile app for the conference
Java
1
star
38

galaxy-gear2-tutorial

Galaxy Gear2 basics tutorial
Java
1
star
39

devoxx-android

Java
1
star
40

docker-java8

1
star
41

scalagram

Instagram's clone to share memes about Scala world
Scala
1
star
42

endpoints4s-vs-tapir-blog-examples

1
star
43

zionomicon

Scala
1
star
44

whisky-tango-foxtrot

Scala
1
star
45

reactive-slick

Scala
1
star