Skip to content

ziahaqi/RoboMQ

Repository files navigation

RoboMQ

RoboMQ is RabbitMQ client wrapper-library for android base on java library

Usage

  • initiation
        //activity or service implement MQCallback  
        MQFactory mqFactory = new MQFactory(MQConfig.hostName,
                MQConfig.virtualHostname,
                MQConfig.username,
                MQConfig.password,
                MQConfig.exchange,
                MQConfig.rotuingkey,
                MQConfig.port);
        
        // callback injected by factory instances for create consumer and produser instance
        MQConsumer mqConsumer = this.mqFactory.createConsumer(this);
        MQProducer mqProducer = this.mqFactory.createProducer(this);
                
  • set property
                    mqConsumer.setQueueName("newQueueName");
                    mqConsumer.setRoutingkey("newRoutingKey");
                    mqConsumer.setExchange("newExchange");
  • start and stop consumer
        mqConsumer.setMessageListner(new MQConsumer.MQConsumerListener() {
            @Override
            public void onMessageReceived(QueueingConsumer.Delivery delivery) {
             //use delivery message
            }
        });
        
        mqConsumer.subsribe();
        mqConsumer.stop();
  • start and stop produser
        mqProducer.publish(message, null);

suggestion

for long running operation, preferably using a service

About

rabbitMQ client library for android

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages