On 29/06/16 13:43, Robbie Gemmell wrote:
I did it that way as a way of showing folks how to do authentication
when creating the connection from the factory.

Which is indeed valuable.

I personally dislike
examples using ANONYMOUS, though I can see the appeal that it avoids
particular credentials, and may be easier out the box for certain
servers. There are of course also other servers out there that dont do
ANONYMOUS by default / especially obviously / at all.

Personally I think for servers, having anonymous enabled by default is safer than having a predefined guest user. However...

Not sure there is a good answer...

What about (a) mentioning the issue in the README (alongside the fact that a queue named 'queue; is expected) and (b) taking the username and password from system properties, env vars or command line args (e.g. see attached for the helloworld example).

That way the user sees the problem coming, but can also easily supply the necessary credentials without having to edit the source. (Not that doing so is arduous, but it makes running things one small step easier).

I admit I'm coming from an atypical pov, which is more in using the examples to do basic tests between different components.
diff -up src/main/java/org/apache/qpid/jms/example/HelloWorld.java.orig src/main/java/org/apache/qpid/jms/example/HelloWorld.java
--- src/main/java/org/apache/qpid/jms/example/HelloWorld.java.orig	2016-06-29 14:01:27.614908861 +0100
+++ src/main/java/org/apache/qpid/jms/example/HelloWorld.java	2016-06-29 14:02:04.510057047 +0100
@@ -48,7 +48,7 @@ public class HelloWorld {
             ConnectionFactory factory = (ConnectionFactory) context.lookup("myFactoryLookup");
             Destination queue = (Destination) context.lookup("myQueueLookup");
 
-            Connection connection = factory.createConnection(USER, PASSWORD);
+            Connection connection = factory.createConnection(System.getProperty("USER"), System.getProperty("PASSWORD"));
             connection.setExceptionListener(new MyExceptionListener());
             connection.start();
 

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to