paho-akka


License

License

Categories

Categories

Akka Container Microservices Reactive libraries
GroupId

GroupId

com.sandinh
ArtifactId

ArtifactId

paho-akka_2.11
Last Version

Last Version

1.5.1
Release Date

Release Date

Type

Type

jar
Description

Description

paho-akka
paho-akka
Project URL

Project URL

https://github.com/giabao/paho-akka
Project Organization

Project Organization

com.sandinh
Source Code Management

Source Code Management

https://github.com/giabao/paho-akka

Download paho-akka_2.11

How to add to project

<!-- https://jarcasting.com/artifacts/com.sandinh/paho-akka_2.11/ -->
<dependency>
    <groupId>com.sandinh</groupId>
    <artifactId>paho-akka_2.11</artifactId>
    <version>1.5.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.sandinh/paho-akka_2.11/
implementation 'com.sandinh:paho-akka_2.11:1.5.1'
// https://jarcasting.com/artifacts/com.sandinh/paho-akka_2.11/
implementation ("com.sandinh:paho-akka_2.11:1.5.1")
'com.sandinh:paho-akka_2.11:jar:1.5.1'
<dependency org="com.sandinh" name="paho-akka_2.11" rev="1.5.1">
  <artifact name="paho-akka_2.11" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.sandinh', module='paho-akka_2.11', version='1.5.1')
)
libraryDependencies += "com.sandinh" % "paho-akka_2.11" % "1.5.1"
[com.sandinh/paho-akka_2.11 "1.5.1"]

Dependencies

compile (4)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.11.12
org.eclipse.paho : org.eclipse.paho.client.mqttv3 jar 1.1.1
com.typesafe.akka : akka-actor_2.11 jar 2.5.27
org.log4s : log4s_2.11 jar 1.8.2

test (3)

Group / Artifact Type Version
org.scalatest : scalatest_2.11 jar 3.1.0
com.typesafe.akka : akka-testkit_2.11 jar 2.5.27
ch.qos.logback : logback-classic jar 1.2.3

Project Modules

There are no modules declared in this project.

paho-akka

Known Vulnerabilities Build Status

What?

This is a Publish Subscribe library for akka to pub/sub to a MQTT server - ex mosquitto. paho-akka use paho as the underlying MQTT client.

We, at http://sandinh.com, use paho-akka to replace Distributed Publish Subscribe in Cluster

Install?

paho-akka is on Maven Center

How to use

val pubsub = actorOf(Props(classOf[MqttPubSub], PSConfig(
    brokerUrl = "tcp://test.mosquitto.org:1883", //all params is optional except brokerUrl
    userName = null,
    password = null,
    //messages received when disconnected will be stash. Messages isOverdue after stashTimeToLive will be discard
    stashTimeToLive = 1.minute,
    stashCapacity = 8000, //stash messages will be drop first haft elems when reach this size
    reconnectDelayMin = 10.millis, //for fine tuning re-connection logic
    reconnectDelayMax = 30.seconds
)))

pubsub ! new Publish(topic, payload)

class SubscribeActor extends Actor {
  pubsub ! Subscribe(topic, self)

  def receive = {
    case SubscribeAck(Subscribe(`topic`, `self`, _), fail) =>
      if (fail.isEmpty) context become ready
      else logger.error(fail.get, s"Can't subscribe to $topic")
  }

  def ready: Receive = {
    case msg: Message => ...
  }
}

Changelog

see [CHANGES.md]

Licence

This software is licensed under the Apache 2 license: http://www.apache.org/licenses/LICENSE-2.0

Copyright 2014 Sân Đình (http://sandinh.com)

Versions

Version
1.5.1
1.5.0
1.4.0
1.3.0
1.2.0
1.1.2
1.1.1
1.1.0
1.0.3
1.0.2
1.0.1
1.0.0