Android Question RabbitMQ and JavaObject

jndaniels1

Member
Licensed User
Longtime User
Hello B4A Family.

I have taken a leap to try to understand the JavaObject in B4a
I have read Erels' tutorial for the JavaObject using Picasso over and over.

Now I know the leap i've taken is probably huge but I want to see if I can integrate the RabbitMQ
with a project I have. So here is my question.

I got all the Jars' in B4A - tested all sorts of invocations and objects and JavaObjects just to get myself a bit more confused. If I could just get an example of how the below could be done in B4A I would appreciate it IMMENSELY !

ConnectionFactory factory = new ConnectionFactory();
factory.setUsername(userName);
factory.setPassword(password);
factory.setVirtualHost(virtualHost);
factory.setHost(hostName);
factory.setPort(portNumber);
Connection conn = factory.newConnection();
Preferably i like to use

ConnectionFactory factory = new ConnectionFactory();
factory.setUri("amqp://userName:password@hostName:portNumber/virtualHost");
Connection conn = factory.newConnection();
Im able to get the "class" initializedStatic but when I try to run any of the methods to set the properties i get the error

java.lang.IllegalArgumentException: expected receiver of type com.rabbitmq.client.ConnectionFactory, but got java.lang.Class<com.rabbitmq.client.ConnectionFactory>
It goes without saying I am not a Java person - but what better way to learn than to jump in the deep end.

The javadoc is located at :
http://www.rabbitmq.com/releases/rabbitmq-java-client/v3.4.3/rabbitmq-java-client-javadoc-3.4.3/com/rabbitmq/client/ConnectionFactory.html

Again to anybody that could give me boost i would be so greatful!

Kindest regards
JEFFD
 

jndaniels1

Member
Licensed User
Longtime User
@Erel - Thanks for the reply - I tried that and got it working.

@rboeck - Thank you for the link! Looks like this will be a solution for my project!

Thanks so much!
Cheers
JEFFD
 
Upvote 0

jndaniels1

Member
Licensed User
Longtime User
well, i spoke too soon

@Erel. I zipped my test code and attached.

I hope you can help as i really want to learn as much as possible.

regards
JEFFD
 

Attachments

  • rabbit.zip
    7.4 KB · Views: 223
Upvote 0

jndaniels1

Member
Licensed User
Longtime User
logs shows:

B4X:
java.lang.reflect.InvocationTargetException


I know im not passing factory object over to the connection object. But this exception comes up.

attached is the error log.

Regards
JEFFD


P.S im a 4.3 user now.
 

Attachments

  • B4Alog.PNG
    B4Alog.PNG
    248.4 KB · Views: 220
Upvote 0
Top