fusebyexample / external-mq-fabric-client Goto Github PK
View Code? Open in Web Editor NEWHow to connect to fabric-based Fuse MQ from JMS clients running outside of Fuse Fabric.
License: Apache License 2.0
How to connect to fabric-based Fuse MQ from JMS clients running outside of Fuse Fabric.
License: Apache License 2.0
I tested on a Fuse 6.3 installation ant it worked fine.
Why README
says it's not supported on 6.3 and later?
We have added admin=admin,admin
to both $FABRIC/etc/users.properties
and $FABRIC/instances/<child-container-name>/etc/users.properties
, then modified the relevant lines of this project's code to read as below:
Context context = new InitialContext();
ConnectionFactory factory = (ConnectionFactory) context.lookup(CONNECTION_FACTORY_NAME);
Destination destination = (Destination) context.lookup(DESTINATION_NAME);
connection = factory.createConnection("admin","admin");
connection.start();
This fails unfortunately. Here's what mvn -e -Pproducer-default
prints out when run on the fabric host:
INFO exec:java {execution: default}
10:47:59 INFO ******************************
10:47:59 INFO Connecting to Fuse MQ Broker using URL: discovery:(fabric:default)
10:47:59 INFO ******************************
10:48:00 INFO Using local ZKClient
10:48:00 INFO Client environment:zookeeper.version=3.4.3-1240972, built on 02/06/2012 10:48 GMT
10:48:00 INFO Client environment:host.name=ithffu01.ocado.com
10:48:00 INFO Client environment:java.version=1.6.0_26
10:48:00 INFO Client environment:java.vendor=Sun Microsystems Inc.
10:48:00 INFO Client environment:java.home=/usr/lib/jvm/java-6-sun-1.6.0.26/jre
10:48:00 INFO Client environment:java.class.path=/usr/share/maven2/boot/classworlds.jar
10:48:00 INFO Client environment:java.library.path=/usr/lib/jvm/java-6-sun-1.6.0.26/jre/lib/amd64/server:/usr/lib/jvm/java-6-sun-1.6.0.26/jre/lib/amd64:/usr/lib/jvm/java-6-sun-1.6.0.26/jre/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
10:48:00 INFO Client environment:java.io.tmpdir=/tmp
10:48:00 INFO Client environment:java.compiler=<NA>
10:48:00 INFO Client environment:os.name=Linux
10:48:00 INFO Client environment:os.arch=amd64
10:48:00 INFO Client environment:os.version=2.6.32-5-amd64
10:48:00 INFO Client environment:user.name=root
10:48:00 INFO Client environment:user.home=/root
10:48:00 INFO Client environment:user.dir=/var/tmp/external-mq-fabric-client-master
10:48:00 INFO Initiating client connection, connectString=localhost:2181 sessionTimeout=10000 watcher=org.linkedin.zookeeper.client.ZKClient@5a81b83c
10:48:00 INFO Opening socket connection to server /127.0.0.1:2181
10:48:00 WARN SecurityException: java.lang.SecurityException: Unable to locate a login configuration occurred when trying to find JAAS configuration.
10:48:00 INFO Client will not SASL-authenticate because the default JAAS configuration section 'Client' could not be found. If you are not using SASL, you may ignore this. On the other hand, if you expected SASL to work, please fix your JAAS configuration.
10:48:00 INFO Socket connection established to localhost/127.0.0.1:2181, initiating session
10:48:00 INFO Session establishment complete on server localhost/127.0.0.1:2181, sessionid = 0x13c48782a180015, negotiated timeout = 10000
10:48:00 INFO Starting StateChangeDispatcher
10:48:00 INFO EventThread shut down
10:48:00 INFO Session: 0x13c48782a180015 closed
10:48:00 ERROR javax.jms.JMSException: Could not connect to broker URL: discovery:(fabric:default). Reason: org.apache.zookeeper.KeeperException$NoAuthException: KeeperErrorCode = NoAuth for /fabric/registry/clusters/fusemq/default
Any suggestions what we're missing?
We've customised this project quite a bit. We now combine it with Ruby and Cucumber, these communicate with Fabric to simulate broker failure by starting and stopping containers containing brokers in the same group. Our customised version of this artifact is downloaded within the Cucumber demo feature and parameterised with CLI system properties specifying the message count, message delay and whether a producer or consumer should be spawned.
There are a few improvements we'd like to suggest to this reference example, listed here as comments on our own modified version:
session
creation the code for both producer and consumer is common. This code is pushed into a common parent class.broker.username
, broker.password
, zookeeper.url
) can be pushed into the <properties>
section to avoid this duplication.SimpleConsumer
breaks the message consumption loop if the message is null
. This isn't supportive of simulating broker failure, since occasionally a null
is received when the broker fails before the client receives an EOFException
. In our version we continue until an expected number of messages is consumed.Regarding (3) - we realise our modification is flawed in that the consumer will run indefinitely if the producer hasn't sent the expected number of messages.
We'd like to know how best to modify the consumer to support a null
message from broker failure and recognise when the broker's running but there are no more messages to consume.
Must you define advisory messages to be certain of this latter situation?
Could you please update your example to correctly support both broker failure and termination upon no more messages? We'd love to learn of the correct approach to handle both scenarios.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.