Giter Site home page Giter Site logo

rmqa's Introduction

rmqa

Download

WARNING!

Url dependencies is deprecated caused bintray shutdown! Please fork for use this library.


Rabbit Message Queue for Android

Implementation minimalized feature of RabbitMQ in android. Goodbye to the fcm API key.

RabbitMQ is a message-queueing software also known as a message broker or queue manager. Simply said; it is software where queues are defined, to which applications connect in order to transfer a message or messages.

rmqa library minimizes RabbitMQ feature for Android, making it easy to use even without knowledge of Message Brokers. While it only supports broadcast messaging and one-way messaging features.

Download

implementation 'com.utsman.rmqa:rmqa:0.0.2'

Prepare

Open https://www.cloudamqp.com and login or sign up. Create your instance, get the server, username, password and vhost.
For detail, you can read offcial RabbitMQ guide for cloudamqp here

Let's Coding !

1. Setup connection

val rmqaConnection = RmqaConnection.Builder(this)
        .setServer("server")
        .setUsername("username")
        .setPassword("password")
        .setVhost("vhost")
        .setExchangeName("exchange_name")
        .setConnectionName("connection_name")
        .setRoutingKey("route_key")
        .setAutoClearQueue(true) // By default it is `false`, when the connection is closed, the queue will be cleared
        .build()

2. Connect and publish for broadcasting message

Connect

Rmqa.connect(rmqaConnection, queueName) { senderId, data ->
      // your code when message arrived
  }

Messages will be received at each queueName that has the same exhangeName. queueName is buffer the stores messages, you can only create one queueName for one rmqaConnection.

Publish / broadcast message

Rmqa.publish(exchangeName, senderId, data)

A message will be sent to each queueName owned by exchangeName.

3. Connect and publish for single receiver

Connect

Rmqa.connect(rmqaConnection, queueName, Rmqa.TYPE.DIRECT) { senderId, data ->
      // your code when message arrived
  }

For this case, the message will be received specifically by the defined queueName without passing through exchangeName. You cannot multiple connect in one RmqaConnection.

Publish single receiver

Rmqa.publishTo(queueName, senderId, data)

Sample chat app
Article on Medium (in bahasa)


Copyright 2019 Muhammad Utsman

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.

rmqa's People

Contributors

kucingapes avatar utsmannn avatar

Stargazers

Kukuh Satrio Wibowo avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.