All Projects → egetman → reactive-jms

egetman / reactive-jms

Licence: Apache-2.0 license
Reactive JMS wrapper

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to reactive-jms

reactive-pulsar
Reactive Streams adapter for Apache Pulsar Java Client
Stars: ✭ 45 (+181.25%)
Mutual labels:  reactive-streams
async
⏱ Promises and reactive-streams in Swift built for high-performance and scalability.
Stars: ✭ 35 (+118.75%)
Mutual labels:  reactive-streams
alpakka-samples
Example projects building Reactive Integrations using Alpakka
Stars: ✭ 61 (+281.25%)
Mutual labels:  reactive-streams
spring-boot-web-application-sample
Real World Spring Boot Web Application Example with tons of ready to use features
Stars: ✭ 143 (+793.75%)
Mutual labels:  jms
kotlin-kafka-and-kafka-streams-examples
Kafka with KafkaReactor and Kafka Streams Examples in Kotlin
Stars: ✭ 33 (+106.25%)
Mutual labels:  reactive-streams
akka-stream-mon
Throughput and latency monitoring for Akka Streams
Stars: ✭ 23 (+43.75%)
Mutual labels:  reactive-streams
Troilus
Troilus is a Java client library for Cassandra.
Stars: ✭ 17 (+6.25%)
Mutual labels:  reactive-streams
sample-spring-webflux
testing webclient reactive communication with spring boot reactive application built on top of spring webflux
Stars: ✭ 21 (+31.25%)
Mutual labels:  reactive-streams
spring-projects
Some spring sample projects
Stars: ✭ 24 (+50%)
Mutual labels:  jms
mongo-images
Ever wonder how you can create a full stack reactive application that also saves images? Well look no further! We've got Spring Webflux, Reactive Mongo Streams with GridFS, and Angular5!
Stars: ✭ 12 (-25%)
Mutual labels:  reactive-streams
Review System Demo
A Spring Boot and AngularJS boilerplate project.
Stars: ✭ 18 (+12.5%)
Mutual labels:  jms
netifi-quickstart-java
Project to assist you in getting started using Netifi.
Stars: ✭ 23 (+43.75%)
Mutual labels:  reactive-streams
akka-cookbook
提供清晰、实用的Akka应用指导
Stars: ✭ 30 (+87.5%)
Mutual labels:  reactive-streams
reactive-streams-in-java
Code for "Reactive Streams in Java" book
Stars: ✭ 19 (+18.75%)
Mutual labels:  reactive-streams
springboot-rsocketjwt-example
Example of using JWT with RSocket and Spring Boot
Stars: ✭ 26 (+62.5%)
Mutual labels:  reactive-streams
learning-dome-code
分享日常java学习代码及用例,包括主流的框架、常用的组件、以及比较好的解决方案,项目会持续更新……
Stars: ✭ 58 (+262.5%)
Mutual labels:  jms
r2dbc-proxy
R2DBC Proxying Framework
Stars: ✭ 108 (+575%)
Mutual labels:  reactive-streams
KotlinReactiveMS
An educational project to learn reactive programming with Spring 5 and Kotlin
Stars: ✭ 33 (+106.25%)
Mutual labels:  reactive-streams
Atmosph4rX
Atmosphere Framework version 4 for Reactive Streams
Stars: ✭ 34 (+112.5%)
Mutual labels:  reactive-streams
jetty-reactive-httpclient
Jetty ReactiveStreams HttpClient
Stars: ✭ 63 (+293.75%)
Mutual labels:  reactive-streams

hex.pm version build status code coverage

Reactive JMS Publisher (wrapper)

Reactive JMS publisher is a simple reactive wrapper for JMS API.

In terms of reactive streams, it is a Cold Publisher. i.e. no data will be lost (via unhandled emitting). Emitting begins right after the client demand's some data.

JMS publisher or rather its Source is unicast by its nature. If multiple clients connect to the same JMS queue, each one will receive unique messages. (The same logic as with common interaction with JMS queue through JMS API).

It's tested with reactive-streams-jvm tck, and verified with amq & wmq brokers.

When to use

If you have some components in your app, that use reactive interfaces, it's a good choice to use one more for easy integration =)

If you want to make some manual/dynamic throughput control, you can check the use cases of Barrier abstraction.

How to use

Creation of JMS Publisher as simple as

final ConnectionFactory factory = ...
final Function<Message, String> messageToString = message -> {
    try {
        return ((TextMessage) message).getText();
    } catch (Exception e) {
        throw new IllegalStateException(e);
    }
};
Publsiher<String> jmsPublisher = new ColdPublisher<>(new UnicastJmsQueueSource<>(factory, messageToString, "MY_COOL_QUEUE"));

Publisher acceps Source<T> instance as data & access provider.

public ColdPublisher(@Nonnull Source<T> source) {
    this.source = Objects.requireNonNull(source, "Source must not be null");
}

You can implement your own source types, it's quite easy:

public interface Source<E> {
    CloseableIterator<E> iterator(int key);
}

Jms source has 2 constructors, that accepts following params:

public UnicastJmsQueueSource(@Nonnull ConnectionFactory factory, @Nonnull Function<Message, T> function,
                             @Nonnull String queue) {
    ...
}
    
public UnicastJmsQueueSource(@Nonnull ConnectionFactory factory, @Nonnull Function<Message, T> function,
                             @Nonnull String queue, String user, String password, boolean transacted, int acknowledgeMode) {
    ...
}

You can use whatever Subscriber<T> you want with ColdPublisher<T>. There is one build in: BalancingSubscriber<T>.

The main idea is you never ask the given Subscription for an unbounded sequence of elements (usually through Long.MAX_VALUE). Instead, you say how much elements you want to process for a concrete time interval. In a case when the application throughput rises too high, you can obtain additional control through Barrier.

The simplest way to create a subscriber:

Subscriber<T> subscriber = new BalancingSubscriber<T>(System.out::println);

Additionally, BalancingSubscriber has several overloaded constructors:

public BalancingSubscriber(@Nonnull Consumer<T> onNext) {
    ...
}

public BalancingSubscriber(@Nonnull Consumer<T> onNext, @Nonnull Barrier barrier) {
    ...
}

public BalancingSubscriber(@Nonnull Consumer<T> onNext, @Nonnull Barrier barrier, int batchSize, int pollInterval) {
    ...
}

public BalancingSubscriber(@Nonnull Consumer<T> onNext, @Nullable Consumer<Throwable> onError,
                           @Nullable Runnable onComplete, @Nonnull Barrier barrier, int batchSize, int pollInterval) {
    ...
}

Please feel free to send a pr =)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].