Skip to content
/ Tunnel Public

Tunnel is Pub-Sub library inspired from NYBus It made with Kotlin Coroutines, Channes and Flow

Notifications You must be signed in to change notification settings

RotBolt/Tunnel

Repository files navigation

Tunnel

Tunnel CI codecov jitpack

Tunnel is Pub-Sub library inspired from NYBus It made with Kotlin Coroutines, Channes and Flow

Architecture

Tunnel Architecture

Information

  • Tunnel-Compiler is annotation procesor that processes Subsribe annotation in Client Code and based on that creates Target Map (Message Delivery Map). Target Map is generated and perisisted as TunnelMap class.

  • TunnelMap is used by Tunnel module to post the message object to correct Subscribed target

Setup

Add it in your root build.gradle at the end of repositories:

allprojects {
	repositories {
		...
		maven { url 'https://jitpack.io' }
	}
}

Step 2. Add the dependency. (latest_tag = v0.0.1 )

	dependencies {
	        implementation 'com.github.RotBolt:Tunnel:latest_tag'
                kapt 'com.github.RotBolt:Tunnel-Compiler:latest_tag'
	}

Usage

  • Register the class
        Tunnel.get().register(RegistryClass(this))

  • Create method to receive the posted messages
    @Subscribe(dispatcherType = DispatcherType.IO, channelIds = ["CHANNEL_1", "CHANNEL_2"])
    fun onEvent(name: Bundle) {
     
    }
  • Post the message object
        Tunnel.get().post(TunnelMessage(Bundle().apply {
                putString("PUI", "Hola")
            }), "CHANNEL_1")

  • You can create separate channels as per need and can subscribe to multiple channels
  • Supported Dispatchers (Uses Coroutine Dispatcher)
    • IO
    • Main
    • Computation
    • Post
    • SingleThreadExecutor

Ongoing

  • Unit Tests

TODO

  • Error checks for invalid method
  • Support for logging

About

Tunnel is Pub-Sub library inspired from NYBus It made with Kotlin Coroutines, Channes and Flow

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages