I actually experience problem
Here are the traces when launching the broker:
-----------------------------------------------------------------------------------------
java version "1.6.0_04"
Java(TM) SE Runtime Environment (build 1.6.0_04-b12)
Java HotSpot(TM) Client VM (build 10.0-b19, mixed mode, sharing)
Warning: Qpid classpath not set. CLASSPATH set to
.\qpid-broker-0.5\lib\qpid-all.jar
Info: QPID_JAVA_GC not set. Defaulting to JAVA_GC -XX:+UseConcMarkSweepGC
Info: QPID_JAVA_MEM not set. Defaulting to JAVA_MEM -Xmx1024m
Using configuration file D:\QPID\.\qpid-broker-0.5\etc\config.xml
Configuring logger using configuration file
D:\QPID\.\qpid-broker-0.5\etc\log4j.xml
2009-07-02 15:56:08,953 INFO [main] management.JMXManagedObjectRegistry
(JMXManagedObjectRegistry.java:162) - JMX ConnectorServer using SSL keystore
file D:\QPID\.\qpid-broker-0.5\etc\qpid.keystore
2009-07-02 15:56:09,218 WARN [main] management.JMXManagedObjectRegistry
(JMXManagedObjectRegistry.java:187) - Starting JMX ConnectorServer on port
'8999' (+9099) with SSL
2009-07-02 15:56:09,750 INFO [main] server.Main (Main.java:279) - Starting
Qpid Broker 0.5 build: exported
2009-07-02 15:56:09,828 INFO [main] server.Main (Main.java:387) - Qpid.AMQP
listening on non-SSL address 0.0.0.0/0.0.0.0:5672
2009-07-02 15:56:09,828 INFO [main] server.Main (Main.java:409) - Qpid Broker
Ready :0.5 build: exported
-----------------------------------------------------------------------------------------
When launching the client, I have the following traces:
-----------------------------------------------------------------------------------------
java version "1.6.0_04"
Java(TM) SE Runtime Environment (build 1.6.0_04-b12)
Java HotSpot(TM) Client VM (build 10.0-b19, mixed mode, sharing)
launching "java -cp
.\javaclient\qpidJavaClient.jar;D:\QPID\qpid-client-0.5\lib\qpid-common-0.5.jar;D:\QPID\qpid-client-0.5\lib\slf4j-api-1.4.0.jar;D:\QPID\qpid-broker-0.5\lib\slf4j-log4j12-1.4.0.jar;D:\QPID\qpid-broker-0.5\lib\log4j-1.2.12.jar;D:\QPID\qpid-client-0.5\lib\mina-core-1.0.1.jar;
XXXXXXXXXXXXXXXXXXXXXXXXXX.sender.SenderMain
Starting the AMQP client : connection creation on port 5672
main 2009-07-02 15:59:53,019 DEBUG [transport.network.io.IoTransport]
default-SO_RCVBUF : 8192
main 2009-07-02 15:59:53,019 DEBUG [transport.network.io.IoTransport]
default-SO_SNDBUF : 8192
main 2009-07-02 15:59:53,019 DEBUG [transport.network.io.IoTransport]
new-SO_RCVBUF : 65536
main 2009-07-02 15:59:53,019 DEBUG [transport.network.io.IoTransport]
new-SO_SNDBUF : 65536
main 2009-07-02 15:59:53,082 DEBUG [apache.qpid.transport.Connection] SEND:
[conn:194df86] AMQP.1 0-10
IoReceiver - localhost/127.0.0.1:5672 2009-07-02 15:59:53,160 DEBUG
[apache.qpid.transport.Connection] RECV: [conn:194df86] AMQP.1 0-9
IoReceiver - localhost/127.0.0.1:5672 2009-07-02 15:59:53,160 DEBUG
[apache.qpid.transport.Connection] connection closed: conn:194df86
Exception in thread "main" org.apache.qpid.transport.ProtocolVersionException:
version mismatch: 0-9
at
org.apache.qpid.transport.ProtocolVersionException.rethrow(ProtocolVersionException.java:59)
at org.apache.qpid.transport.Connection.connect(Connection.java:202)
at org.apache.qpid.transport.Connection.connect(Connection.java:167)
at com.airbus.fsang.test.amqp.sender.SenderMain.main(SenderMain.java:61)
Caused by: org.apache.qpid.transport.ProtocolVersionException: version
mismatch: 0-9
at org.apache.qpid.transport.ClientDelegate.init(ClientDelegate.java:70)
at org.apache.qpid.transport.ClientDelegate.init(ClientDelegate.java:42)
at
org.apache.qpid.transport.ProtocolHeader.delegate(ProtocolHeader.java:103)
at org.apache.qpid.transport.Connection.received(Connection.java:285)
at org.apache.qpid.transport.Connection.received(Connection.java:52)
at org.apache.qpid.transport.network.Assembler.emit(Assembler.java:98)
at org.apache.qpid.transport.network.Assembler.init(Assembler.java:118)
at
org.apache.qpid.transport.ProtocolHeader.delegate(ProtocolHeader.java:108)
at
org.apache.qpid.transport.network.Assembler.received(Assembler.java:103)
at
org.apache.qpid.transport.network.Assembler.received(Assembler.java:48)
at
org.apache.qpid.transport.network.InputHandler.next(InputHandler.java:150)
at
org.apache.qpid.transport.network.InputHandler.received(InputHandler.java:103)
at
org.apache.qpid.transport.network.InputHandler.received(InputHandler.java:42)
at
org.apache.qpid.transport.network.io.IoReceiver.run(IoReceiver.java:128)
at java.lang.Thread.run(Thread.java:619)
-----------------------------------------------------------------------------------------
My client code is the following:
-----------------------------------------------------------------------------------------
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.sender;
import org.apache.qpid.transport.Connection;
import org.apache.qpid.transport.DeliveryProperties;
import org.apache.qpid.transport.Header;
import org.apache.qpid.transport.MessageAcceptMode;
import org.apache.qpid.transport.MessageAcquireMode;
import org.apache.qpid.transport.Session;
/**
* @author yLeglise
*/
public final class SenderMain {
/**
* Connection port.
*/
public static final int CONNECTION_PORT = 5672;
/**
* Number of sending message iterations.
*/
private static final int ITERATION_NUMBER = 5;
/**
* Name of the queue.
*/
private static final String QUEUE_NAME = "amq.direct";
/**
* Default constructor.
*/
private SenderMain() {
// Utility class
}
/**
* Send a message in AMQP queue.
* @param aSession : the session.
* @param aDeliveryProperties : the delivery properties.
* @param aQueueName : the queue name.
* @param aContents : the contents of the message.
*/
protected static void sendMessage(Session aSession,
DeliveryProperties aDeliveryProperties, String aQueueName,
String aContents) {
// Trace message sending
System.out.println("Sending a message containing " + aContents
+ " to queue " + aQueueName);
// Send the message
aSession.messageTransfer(aQueueName, MessageAcceptMode.EXPLICIT,
MessageAcquireMode.PRE_ACQUIRED, new Header(aDeliveryProperties),
aContents);
}
/**
* Main function.
* @param args : program arguments.
*/
public static void main(String[] args) {
System.out
.println("Starting the AMQP client : connection creation on port "
+ CONNECTION_PORT);
// Create connection
Connection connection = new Connection();
// connect(host, port, vhost, username, password, SSLFlag)
connection.connect("localhost", CONNECTION_PORT, "test", "guest",
"guest",
false);
// Create session (expiry)
Session session = connection.createSession(0);
DeliveryProperties deliveryProps = new DeliveryProperties();
deliveryProps.setRoutingKey("routing_key");
// Iterate on message sending
for (int i = 0; i < ITERATION_NUMBER; i++) {
sendMessage(session, deliveryProps, QUEUE_NAME, "Message " + i);
}
// Send last message
sendMessage(session, deliveryProps, QUEUE_NAME, "Terminated");
// confirm completion
session.sync();
// cleanup
session.close();
connection.close();
}
}
-----------------------------------------------------------------------------------------
So, as you can see in the client traces, AMQP.1 0-10 is sent by the client to
the broker, which is
normal according to the code of the connect method of the Connection class (new
ProtocolHeader(1, 0, 10)).
I do not see any attempt of negociation...
Maybe all this details could help to find the problem.
Thank you
Yann LEGLISE
-----Message d'origine-----
De : Marnie McCormack [mailto:[email protected]]
Envoyé : jeudi 2 juillet 2009 15:38
À : [email protected]
Objet : Re: QPID java client release compatibility with AMQP version
Hi Yann,
Using the Java Broker & Client together does not require you to specify the
protocol version - the client & broker will negotiate to the best (latest)
available version, currently 0-9.
Let us know if you have any problems ?
Thanks,
Marnie
On Thu, Jul 2, 2009 at 2:28 PM, Leglise Yann <[email protected]>wrote:
> Hello,
>
> I am new to QPID and I have a question about QPID java client release
> compatibility with AMQP version.
> I am using the last version of java broker (0.5) which can only handle
> up to AMQP 0-9, and the last version of java client (0.5) which can
> handle either AMQP 0-10 or 0-9 or 0-8 (as specified in
> http://qpid.apache.org/amqp-compatibility.html) . But to make the
> client and the broker able to communicate, I need to specify to the
> client to use the 0-9 version.
> I could not found any API to do this. So I browsed the repository, and
> I found the connect method code of Connection class :
>
>
> public void connect(String host, int port, String vhost, String
> username, String password, boolean ssl,String saslMechs)
> {
> synchronized (lock)
> {
> state = OPENING;
>
> delegate = new ClientDelegate(vhost, username,
> password,saslMechs);
>
> IoTransport.connect(host, port,
> ConnectionBinding.get(this), ssl);
> send(new ProtocolHeader(1, 0, 10));
>
> ....
>
>
> As far as I can understand, the AMQP version is fixed and cannot be
> parametered, so why the java client is said to be compatible with
> version
> 0-9 ?
>
> Thank you for the explanation.
>
>
> Regards,
>
>
>
> Yann LEGLISE
> Agence STIE - Division Midi-Pyrénées
> Sopra group.
> 1 Avenue André Marie Ampère
> BP 10134 - 31772 Colomiers Cedex
> (Bureau 1C16)
> Phone : +33 (0)5 34 56 71 07
> [email protected] - www.sopragroup.com
> <http://www.sopragroup.com/> Ce message peut contenir des informations
> confidentielles dont la divulgation est à ce titre rigoureusement
> interdite en l'absence d'autorisation explicite de l'émetteur. Dans
> l'hypothèse où vous auriez reçu par erreur ce message, merci de le
> renvoyer à l'émetteur et de détruire toute copie.
>
> P Pensez à l'environnement avant d'imprimer.
>
>
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:[email protected]