[rabbitmq-discuss] basicpublish Android to Java?

Josh Geisser josh at gebaschtel.ch
Thu May 10 01:10:32 BST 2012


Hi Muhammad

I think I had the same issue (based on the same tutorial), publishing first message resulted in nothing, and then publishing a 2nd time threw a
a com.rabbitmq.client.AlreadyClosedException: clean connection shutdown; reason: Attempt to use closed channel

As my environment was quite old I thought of starting all over again with a fresh installation of everything. And somehow it's working now :)
mChannel.basicPublish() can just be invoked from the Main-thread as simple as it should be.

I also hit a exeption that I'm not allowed to open network connection (open TCP session?) from main activity, which I could overwrite with

/* overwrite the android.os.NetworkOnMainThreadException */
        StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
        StrictMode.setThreadPolicy(policy);
/* not sure this is a good thing, but seems to work */

Just in case you're still into this.

Cheers
Josh

Tutorial http://simonwdixon.wordpress.com/2011/06/03/getting-started-with-rabbitmq-on-android-part-1/
currently using rabbit 2.8.2 java lib with SDK19/ADT18.0.0/IndigoSR2 in an Android 4.0.3 project, not tested on physical device yet :'(

-----Original Message-----
From: rabbitmq-discuss-bounces at lists.rabbitmq.com [mailto:rabbitmq-discuss-bounces at lists.rabbitmq.com] On Behalf Of Kamran
Sent: Montag, 20. Februar 2012 15:08
To: rabbitmq-discuss at lists.rabbitmq.com
Subject: Re: [rabbitmq-discuss] basicpublish Android to Java?

Thanks,
           the consumer of android works fine
        	   mQueue = mModel.queueDeclare().getQueue();
        	   MySubscription = new QueueingConsumer(mModel);
        	   mModel.basicConsume(mQueue, false, MySubscription);"

and the list_consumers shows the declared queues.

The problem lies in the publisher/sender in Android, maybe I should re- install the environment.


On Feb 20, 2:49 pm, Emile Joubert <em... at rabbitmq.com> wrote:
> Hi,
>
> On 20/02/12 13:30, Kamran wrote:
>
> >     private final static String QUEUE_NAME = "hello"; 
> > MessageConsumer("192.168.2.3","logs","fanout");
>
> How does your consumer know which queue to listen on?
>
> You can confirm whether your message consumer is correctly registered 
> by running "rabbitmqctl list_consumers" or "rabbitmqctl list_queue 
> consumers". If your consumer is listed in the results then it should 
> receive messages. If it is not listed then the registration is faulty.
>
> -Emile
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-disc... at lists.rabbitmq.comhttps://lists.rabbitmq.com/cgi-bin/
> mailman/listinfo/rabbitmq-discuss
_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss at lists.rabbitmq.com
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss

--
----
ASG at hnet

-- 
----
ASG at hnet


More information about the rabbitmq-discuss mailing list