java client library

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

java client library

aniruddh narayan
Hi,
I have downloaded rabbitmq complete bundle and installed the server and the "broker running"
message is displayed....but whenever i try to compile an example from the "java client examples"......persay like "HelloServer.java"......i get a compilation error....like the following

C:\>javac HelloServer.java
HelloServer.java:34: package com.rabbitmq.client does not exist
import com.rabbitmq.client.AMQP;
                           ^
HelloServer.java:35: package com.rabbitmq.client does not exist
import com.rabbitmq.client.Channel;
                           ^
HelloServer.java:36: package com.rabbitmq.client does not exist
import com.rabbitmq.client.Connection;
                           ^
HelloServer.java:37: package com.rabbitmq.client does not exist
import com.rabbitmq.client.ConnectionFactory;
                           ^
HelloServer.java:38: package com.rabbitmq.client does not exist
import com.rabbitmq.client.StringRpcServer;
                           ^
HelloServer.java:44: package AMQP does not exist
            int portNumber = (args.length > 1) ? Integer.parseInt(args[1]) : AMQ
P.PROTOCOL.PORT;


HelloServer.java:46: cannot find symbol
symbol  : class ConnectionFactory
location: class com.rabbitmq.examples.HelloServer
            ConnectionFactory connFactory = new ConnectionFactory();
            ^
HelloServer.java:46: cannot find symbol
symbol  : class ConnectionFactory
location: class com.rabbitmq.examples.HelloServer
            ConnectionFactory connFactory = new ConnectionFactory();
                                                ^
HelloServer.java:47: cannot find symbol
symbol  : class Connection
location: class com.rabbitmq.examples.HelloServer
            Connection conn = connFactory.newConnection(hostName, portNumber);
            ^
HelloServer.java:48: cannot find symbol
symbol  : class Channel
location: class com.rabbitmq.examples.HelloServer
            final Channel ch = conn.createChannel();
                  ^
HelloServer.java:51: cannot find symbol
symbol  : class StringRpcServer
location: class com.rabbitmq.examples.HelloServer
            StringRpcServer server = new StringRpcServer(ch, "Hello") {
            ^
HelloServer.java:51: cannot find symbol

Bascially its not able to impor the packages.....


Any help will be much appreciated.....
thanks...aniruddh


Love Cricket? Check out live scores, photos, video highlights and more. Click here.
_______________________________________________
rabbitmq-discuss mailing list
[hidden email]
http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Reply | Threaded
Open this post in threaded view
|

Re: java client library

Ben Hood
Aniruddh,

On Mon, Sep 7, 2009 at 6:41 AM, aniruddh
narayan<[hidden email]> wrote:
> C:\>javac HelloServer.java
> HelloServer.java:34: package com.rabbitmq.client does not exist
> import com.rabbitmq.client.AMQP;

You are missing a compile dependency because you have not specified
anything on the classpath. The source distribution has an ant script
to help out here.

Ben

_______________________________________________
rabbitmq-discuss mailing list
[hidden email]
http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Reply | Threaded
Open this post in threaded view
|

java client library rpc client

Reddy, Rajesh (GPT EMEA)-2
Hi

Iam having trouble using the java rpcclient for multiple replies.
Basically my process makes an rpccall and gets reply from one or more
other process. This works if the rpcclient receives one reply for its
request, but as soon as it gets multiple replies it fails. I get the
following exception which doesn't say much about the root cause.

The case here is the process should check for dependent process, so it
sends a rpc call to all existing process and then decide if the required
service is up and running.
This is possible in .NET library of rabbitmq and working fine.

Any help is appreciated.

Error:
Consumer com.rabbitmq.client.RpcClient$1@b27c38 method handleDelivery
for channel
AMQChannel(amqp://[hidden email]:5672/,1) threw an
exception:
java.lang.NullPointerException
        at
com.rabbitmq.client.RpcClient$1.handleDelivery(RpcClient.java:153)
        at
com.rabbitmq.client.impl.ChannelN.processAsync(ChannelN.java:223)
        at
com.rabbitmq.client.impl.AMQChannel.handleCompleteInboundCommand(AMQChan
nel.java:159)
        at
com.rabbitmq.client.impl.AMQChannel.handleFrame(AMQChannel.java:110)
        at
com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:4
24)

Thanks
Rajesh



--------------------------------------------------------------------------
This message w/attachments (message) may be privileged, confidential or proprietary, and if you are not an intended recipient, please notify the sender, do not use or share it and delete it. The information contained in this e-mail was obtained from sources believed to be reliable; however, the accuracy or completeness of this information is not guaranteed. Unless specifically indicated, this message is not an offer to sell or a solicitation of any investment products or other financial product or service, an official confirmation of any transaction, or an official statement of Merrill Lynch. Subject to applicable law, Merrill Lynch may monitor, review and retain e-communications (EC) traveling through its networks/systems. The laws of the country of each sender/recipient may impact the handling of EC, and EC may be archived, supervised and produced in countries other than the country in which you are located. This message cannot be guaranteed to be secure or error-free. References to "Merrill Lynch" are references to any company in the Merrill Lynch & Co., Inc. group of companies, which are wholly-owned by Bank of America Corporation. Securities and Insurance Products: * Are Not FDIC Insured * Are Not Bank Guaranteed * May Lose Value * Are Not a Bank Deposit * Are Not a Condition to Any Banking Service or Activity * Are Not Insured by Any Federal Government Agency. Past performance is no guarantee of future results. Attachments that are part of this E-communication may have additional important disclosures and disclaimers, which you should read. This message is subject to terms available at the following link: http://www.ml.com/e-communications_terms/. By messaging with Merrill Lynch you consent to the foregoing.
--------------------------------------------------------------------------
 

_______________________________________________
rabbitmq-discuss mailing list
[hidden email]
http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Reply | Threaded
Open this post in threaded view
|

Re: java client library rpc client

Matthias Radestock-3
Rajesh,

Reddy, Rajesh (GPT EMEA) wrote:
> Basically my process makes an rpccall and gets reply from one or more
> other process. This works if the rpcclient receives one reply for its
> request, but as soon as it gets multiple replies it fails. I get the
> following exception which doesn't say much about the root cause.

The rpc abstractions that ship with the RabbitMQ clients are not
designed to handle multiple replies.

> This is possible in .NET library of rabbitmq and working fine.

The difference between the Java and .net version is that the former
processes replies eagerly, i.e. any message received from the rpc
client's reply queue is processed immediately, whereas the .net version
processes replies lazily, i.e. only when an rpc caller is waiting for a
result. If you tried re-using the same .net SimpleRpcClient instance for
another call things would break in much the same way as for the Java
client since the code would find a reply that is not correlated to the
current request.

To implement the "wait for first reply and discard all others" pattern
properly I suggest you amend the rpc client code with an "unexpected
reply" handler/callback that by default throws an exception (thus
mimicking the current behaviour). In your application code you could
then set that handler to ignore unexpected replies instead.

Patches are welcome.


Regards,

Matthias.

_______________________________________________
rabbitmq-discuss mailing list
[hidden email]
http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Reply | Threaded
Open this post in threaded view
|

Re: java client library rpc client

Reddy, Rajesh (GPT EMEA)-2
Hi Matthias,

The .net client has a overload call() defined which invokes cast()(Sends
an asynchronous/one-way message) and then Retrieves the reply from the
Subscription object which is consuming from the reply queue of the
consumer.
So in this way you get the first reply back immediately and then you can
poll the subscription for any more replies.

I have extended the java rpcclient to work in a similar way by using
QueingConsumer instead of Default consumer.

Thanks
Rajesh

-----Original Message-----
From: Matthias Radestock [mailto:[hidden email]]
Sent: 23 April 2010 09:09
To: Reddy, Rajesh (GPT EMEA)
Cc: [hidden email]
Subject: Re: [rabbitmq-discuss] java client library rpc client


Rajesh,

Reddy, Rajesh (GPT EMEA) wrote:
> Basically my process makes an rpccall and gets reply from one or more
> other process. This works if the rpcclient receives one reply for its
> request, but as soon as it gets multiple replies it fails. I get the
> following exception which doesn't say much about the root cause.

The rpc abstractions that ship with the RabbitMQ clients are not
designed to handle multiple replies.

> This is possible in .NET library of rabbitmq and working fine.

The difference between the Java and .net version is that the former
processes replies eagerly, i.e. any message received from the rpc
client's reply queue is processed immediately, whereas the .net version
processes replies lazily, i.e. only when an rpc caller is waiting for a
result. If you tried re-using the same .net SimpleRpcClient instance for

another call things would break in much the same way as for the Java
client since the code would find a reply that is not correlated to the
current request.

To implement the "wait for first reply and discard all others" pattern
properly I suggest you amend the rpc client code with an "unexpected
reply" handler/callback that by default throws an exception (thus
mimicking the current behaviour). In your application code you could
then set that handler to ignore unexpected replies instead.

Patches are welcome.


Regards,

Matthias.

--------------------------------------------------------------------------
This message w/attachments (message) may be privileged, confidential or proprietary, and if you are not an intended recipient, please notify the sender, do not use or share it and delete it. The information contained in this e-mail was obtained from sources believed to be reliable; however, the accuracy or completeness of this information is not guaranteed. Unless specifically indicated, this message is not an offer to sell or a solicitation of any investment products or other financial product or service, an official confirmation of any transaction, or an official statement of Merrill Lynch. Subject to applicable law, Merrill Lynch may monitor, review and retain e-communications (EC) traveling through its networks/systems. The laws of the country of each sender/recipient may impact the handling of EC, and EC may be archived, supervised and produced in countries other than the country in which you are located. This message cannot be guaranteed to be secure or error-free. References to "Merrill Lynch" are references to any company in the Merrill Lynch & Co., Inc. group of companies, which are wholly-owned by Bank of America Corporation. Securities and Insurance Products: * Are Not FDIC Insured * Are Not Bank Guaranteed * May Lose Value * Are Not a Bank Deposit * Are Not a Condition to Any Banking Service or Activity * Are Not Insured by Any Federal Government Agency. Past performance is no guarantee of future results. Attachments that are part of this E-communication may have additional important disclosures and disclaimers, which you should read. This message is subject to terms available at the following link: http://www.ml.com/e-communications_terms/. By messaging with Merrill Lynch you consent to the foregoing.
--------------------------------------------------------------------------
 

_______________________________________________
rabbitmq-discuss mailing list
[hidden email]
http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss