alpakka-connectors

Alpakka connectors to integrate external systems with Akka Streams

Лицензия

Лицензия

Категории

Категории

Akka Контейнер Микросервисы Reactive libraries
Группа

Группа

no.sysco.middleware.alpakka
Идентификатор

Идентификатор

alpakka-connectors
Последняя версия

Последняя версия

0.1.10
Дата

Дата

Тип

Тип

pom
Описание

Описание

alpakka-connectors
Alpakka connectors to integrate external systems with Akka Streams
Ссылка на сайт

Ссылка на сайт

http://github.com/sysco-middleware/alpakka-connectors
Система контроля версий

Система контроля версий

http://github.com/sysco-middleware/alpakka-connectors/tree/master

Скачать alpakka-connectors

Имя Файла Размер
alpakka-connectors-0.1.10.pom 11 KB
Обзор

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/no.sysco.middleware.alpakka/alpakka-connectors/ -->
<dependency>
    <groupId>no.sysco.middleware.alpakka</groupId>
    <artifactId>alpakka-connectors</artifactId>
    <version>0.1.10</version>
    <type>pom</type>
</dependency>
// https://jarcasting.com/artifacts/no.sysco.middleware.alpakka/alpakka-connectors/
implementation 'no.sysco.middleware.alpakka:alpakka-connectors:0.1.10'
// https://jarcasting.com/artifacts/no.sysco.middleware.alpakka/alpakka-connectors/
implementation ("no.sysco.middleware.alpakka:alpakka-connectors:0.1.10")
'no.sysco.middleware.alpakka:alpakka-connectors:pom:0.1.10'
<dependency org="no.sysco.middleware.alpakka" name="alpakka-connectors" rev="0.1.10">
  <artifact name="alpakka-connectors" type="pom" />
</dependency>
@Grapes(
@Grab(group='no.sysco.middleware.alpakka', module='alpakka-connectors', version='0.1.10')
)
libraryDependencies += "no.sysco.middleware.alpakka" % "alpakka-connectors" % "0.1.10"
[no.sysco.middleware.alpakka/alpakka-connectors "0.1.10"]

Зависимости

compile (1)

Идентификатор библиотеки Тип Версия
org.scala-lang : scala-library jar 2.12.6

Модули Проекта

  • alpakka-files
  • alpakka-zeromq
  • alpakka-brave

Alpakka Connectors

Build Status

Maven metadata URI

File Connectors

Listening to changes in a directory

The RecursiveDirectoryChangesSource tries to improve the existing DirectoryChangesSource from alpakka with recursive folder monitoring. It will emit elements every time there is a change to a watched directory in the local file system or any of the subdirectories (new or existing). The enumeration consists of the path that was changed and an enumeration describing what kind of change it was.

import no.sysco.middleware.alpakka.files.javadsl.RecursiveDirectoryChangesSource;

public class App {
    public static void main(String[] args){
        final ActorSystem system = ActorSyste.create();
        final ActorMaterializer mat = ActorMaterializer.create(system);
        
        final FileSystem fs = FileSystems.getDefault();
        final Duration pollingInterval = Duration.of(1, ChronoUnit.SECONDS);
        final int maxBufferSize = 1000;
        final Source<Pair<Path, DirectoryChange>, NotUsed> changes =
            RecursiveDirectoryChangesSource.create(fs.getPath(path), pollingInterval, maxBufferSize);


        changes.runForeach((Pair<Path, DirectoryChange> pair) -> {
            final Path changedPath = pair.first();
            final DirectoryChange change = pair.second();
            System.out.println("Path: " + changedPath + ", Change: " + change);
        }, mat);
    }
}

ZeroMQ Connectors

ZeroMQ Connector uses JeroMQ library to expose Source, Flow and Sinks based on ZeroMQ Socket types (e.g. PUB/SUB, PULL/PUSH).

import no.sysco.middleware.alpakka.zeromq.javadsl.Zmq;

public class App {
    public static void main(String[] args) {
        final ActorSystem system = ActorSystem.create();
        final ActorMaterializer mat = ActorMaterializer.create(system);
        
        Source.repeat("hello")
              .map(ZMsg::createNewMsg)
              .to(Zmq.publishServerSink("tcp://*:5555"))
              .run(mat);
        
        Zmq.subscribeClientSource("tcp://localhost:5555")
           .map(zmsg -> {
               System.out.println(zmsg.popString());
               return zmsg;
           })
           .runWith(Sink.ignore(), mat);
    }
}

Zipkin-Brave Connectors

Brave connectors create Spans flows to integrate tracing into your Akka Streams applications.

public class App {
  public static void main(String[] args){
    final ActorSystem system = ActorSystem.create();
        final ActorMaterializer mat = ActorMaterializer.create(system);
        
        final Tracing tracing = ...;
        
        Source.repeat("hello")
          .via(Brave.startSpanFlow(tracing, "akka-stream-trace"))
          .via(Brave.childSpanFlow(tracing, "akka-stream-span-map", Flow.<String>create().map(s -> s)))
          .via(Brave.finishSpanFlow(tracing))
          .to(Sink.ignore())
          .run(materializer);
  }
}
no.sysco.middleware.alpakka

SYSCO Middleware

Middleware Department from SYSCO AS

Версии библиотеки

Версия
0.1.10
0.1.6
0.1.3
0.1.1