Event Stream

Library to abstract publish and subscribe implementation in an event-based arquitecture

License

License

GroupId

GroupId

com.github.malkomich
ArtifactId

ArtifactId

event-stream
Last Version

Last Version

1.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

Event Stream
Library to abstract publish and subscribe implementation in an event-based arquitecture
Project URL

Project URL

https://github.com/malkomich/event-stream
Source Code Management

Source Code Management

https://github.com/malkomich/event-stream

Download event-stream

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.malkomich/event-stream/ -->
<dependency>
    <groupId>com.github.malkomich</groupId>
    <artifactId>event-stream</artifactId>
    <version>1.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.malkomich/event-stream/
implementation 'com.github.malkomich:event-stream:1.0.1'
// https://jarcasting.com/artifacts/com.github.malkomich/event-stream/
implementation ("com.github.malkomich:event-stream:1.0.1")
'com.github.malkomich:event-stream:jar:1.0.1'
<dependency org="com.github.malkomich" name="event-stream" rev="1.0.1">
  <artifact name="event-stream" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.malkomich', module='event-stream', version='1.0.1')
)
libraryDependencies += "com.github.malkomich" % "event-stream" % "1.0.1"
[com.github.malkomich/event-stream "1.0.1"]

Dependencies

compile (1)

Group / Artifact Type Version
io.vertx : vertx-kafka-client jar 3.5.4

Project Modules

There are no modules declared in this project.

Event Stream

Build Status

Overview

Library to abstract publish and subscribe implementation in an event-based arquitecture.

Requisites

  • Java 8+
  • Maven 3+

Install

Gradle

    dependencies {
        compile 'com.github.malkomich:event-stream:1.0.2'
    }

Maven

    <dependency>
        <groupId>com.github.malkomich</groupId>
        <artifactId>event-stream</artifactId>
        <version>1.0.2</version>
    </dependency>

Usage

INITIALIZATION:
final KafkaConfig config = KafkaConfig.builder()
    .server("localhost:9092")
    .groupId("groupId")
    .build();

final EventService eventService = EventComponent.builder()
    .vertx(vertx)
    .kafkaConfig(config)
    .build();
PUBLISH:
final EventTopic topic = BetchainTopic.QUOTE; // You can build your own EventTopic implementation

final PublishRequest request = PublishRequest.builder()
    .topic(topic)
    .message(data.toJson())
    .build();

eventService.publish(request, onEventPublished -> {
    if (onEventPublished.succeeded()) {
        future.complete();
    } else {
        future.fail(onEventPublished.cause());
    }
});
SUBSCRIBE:
final EventTopic topic = BetchainTopic.QUOTE; // You can build your own EventTopic implementation

final SubscribeRequest request = SubscribeRequest.builder()
    .topic(topic)
    .handler(onEventReceived ->
            scrappingRepository.execute(onEventReceived.value(), Future.future()))
    .build();

eventService.subscribe(request, onSubscribed -> {
    if (onSubscribed.succeeded()) {
        handler.handle(Future.succeededFuture());
    } else {
        handler.handle(Future.failedFuture(onSubscribed.cause()));
    }
});

License

Apache License

Versions

Version
1.0.1
1.0.0