RxBusDispatcher

Event bus running on type safe RxJava queues

License

License

Categories

Categories

Net
GroupId

GroupId

net.jokubasdargis.rxbus
ArtifactId

ArtifactId

rxbus-dispatcher
Last Version

Last Version

2.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

RxBusDispatcher
Event bus running on type safe RxJava queues
Project URL

Project URL

https://github.com/eleventigers/rxbus
Source Code Management

Source Code Management

https://github.com/eleventigers/rxbus

Download rxbus-dispatcher

How to add to project

<!-- https://jarcasting.com/artifacts/net.jokubasdargis.rxbus/rxbus-dispatcher/ -->
<dependency>
    <groupId>net.jokubasdargis.rxbus</groupId>
    <artifactId>rxbus-dispatcher</artifactId>
    <version>2.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/net.jokubasdargis.rxbus/rxbus-dispatcher/
implementation 'net.jokubasdargis.rxbus:rxbus-dispatcher:2.0.0'
// https://jarcasting.com/artifacts/net.jokubasdargis.rxbus/rxbus-dispatcher/
implementation ("net.jokubasdargis.rxbus:rxbus-dispatcher:2.0.0")
'net.jokubasdargis.rxbus:rxbus-dispatcher:jar:2.0.0'
<dependency org="net.jokubasdargis.rxbus" name="rxbus-dispatcher" rev="2.0.0">
  <artifact name="rxbus-dispatcher" type="jar" />
</dependency>
@Grapes(
@Grab(group='net.jokubasdargis.rxbus', module='rxbus-dispatcher', version='2.0.0')
)
libraryDependencies += "net.jokubasdargis.rxbus" % "rxbus-dispatcher" % "2.0.0"
[net.jokubasdargis.rxbus/rxbus-dispatcher "2.0.0"]

Dependencies

compile (1)

Group / Artifact Type Version
net.jokubasdargis.rxbus : rxbus jar 2.0.0

test (3)

Group / Artifact Type Version
org.mockito : mockito-core jar 1.10.8
junit : junit jar 4.12
com.google.truth : truth jar 0.25

Project Modules

There are no modules declared in this project.

RxBus

Event bus running on type safe RxJava queues

Download

Gradle:

compile 'net.jokubasdargis.rxbus:rxbus:2.0.0'

// Optional
compile 'net.jokubasdargis.rxbus:rxbus-android:2.0.0'
compile 'net.jokubasdargis.rxbus:rxbus-dispatcher:2.0.0'

Snapshots of the development version are available in Sonatype's snapshots repository.

Usage

Basic use - event delivery transport tightly coupled by an event type

  • Create a default bus

    Bus bus = RxBus.create();

    or if you are on Android:

    Bus bus = RxAndroidBus.create();
  • Prepare a Queue for an event type. You might want to maintain a collection of static queues as:

    public final class Queues {
      public static final Queue<Event> TRACKING  = Queue.of(TrackingEvent.class).build();
    }
  • Use a queue when subscribing

    Subscription subscription = bus.subscribe(Queues.TRACKING, new Observer<Event> {
      ...
      @Override
      public void onNext(TrackingEvent event) {
        // do something with the event
      }
    })
  • and publishing:

    bus.publish(Queues.TRACKING, new TrackingEvent())

Origin

Adapted from Soundcloud's reactive bus appraoch as seen in mttkay's Reactive Soundcloud slides:

bus

bus

License

Copyright 2016 Jokubas Dargis

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Versions

Version
2.0.0
1.2.0
1.1.2