Auto-properties start: file:bundles/slf4j.log4j12_1.7.5.jar (org.osgi.framework.BundleException: Fragment bundles can not be started.) log4j:WARN No appenders could be found for logger (org.eclipse.moquette.server.Server). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. ERROR: Bundle org.eclipse.moquette.bundle [5] Error starting file:bundles/org.eclipse.moquette.bundle_0.7.0.SNAPSHOT.jar (org.osgi.framework.BundleException: Activator start error in bundle org.eclipse.moquette.bundle [5].) java.lang.NoClassDefFoundError: sun/misc/Unsafe at com.lmax.disruptor.util.Util$1.run(Util.java:102) at com.lmax.disruptor.util.Util$1.run(Util.java:99) at java.security.AccessController.doPrivileged(Native Method) at com.lmax.disruptor.util.Util.<clinit>(Util.java:108) at com.lmax.disruptor.RingBufferFields.<clinit>(RingBuffer.java:34) at com.lmax.disruptor.dsl.Disruptor.<init>(Disruptor.java:70) at org.eclipse.moquette.spi.impl.SimpleMessaging.init(SimpleMessaging.java:88) at org.eclipse.moquette.server.Server.startServer(Server.java:90) at org.eclipse.moquette.server.Server.startServer(Server.java:76) at org.eclipse.moquette.server.Server.startServer(Server.java:59) at org.eclipse.moquette.bundle.Activator.start(Activator.java:37) at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:645) at org.apache.felix.framework.Felix.activateBundle(Felix.java:2154) at org.apache.felix.framework.Felix.startBundle(Felix.java:2072) at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1299) at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:304) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.ClassNotFoundException: sun.misc.Unsafe not found by org.eclipse.moquette.bundle [5] at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1556) at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:77) at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1993) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ... 17 more ERROR: Bundle com.lmax.disruptor [6] Error starting file:bundles/com.lmax.disruptor_3.3.0.jar (org.osgi.framework.BundleException: Unresolved constraint in bundle com.lmax.disruptor [6]: Unable to resolve 6.0: missing requirement [6.0] osgi.wiring.package; (osgi.wiring.package=sun.misc)) org.osgi.framework.BundleException: Unresolved constraint in bundle com.lmax.disruptor [6]: Unable to resolve 6.0: missing requirement [6.0] osgi.wiring.package; (osgi.wiring.package=sun.misc) at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4002) at org.apache.felix.framework.Felix.startBundle(Felix.java:2045) at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1299) at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:304) at java.lang.Thread.run(Thread.java:745) Signed-off-by: Markus Rathgeb <[email protected]>
What is Moquette?
Moquette aims to be a MQTT compliant broker. The broker supports QoS 0, QoS 1 and QoS 2.
Its designed to be evented, uses Netty for the protocol encoding and decoding part, the protocol logic is essentially a single threaded and it's isolated from front connectors part by LMAX disruptor's ring buffer.
Who use it?
[Freedomotic] (http://www.freedomotic.com/) Is an home automation framework, uses Moquette embedded to interface with MQTT world. Part of moquette are also used into the [Vertx MQTT module] (https://github.com/giovibal/vertx-mqtt-broker-mod), into MQTT spy and into [WSO2 Messge broker] (http://techexplosives-pamod.blogspot.it/2014/05/mqtt-transport-architecture-wso2-mb-3x.html).
1 minute set up
Start play with it, download the self distribution tar from BinTray , the un untar and start the broker listening on 1883 port and enjoy!
tar zxf distribution-0.6-bundle-tar.tar.gz
cd bin
./moquette.sh
Running inside OSGi container
Starting from version 0.6 Moquette is OSGi compliant, to see it in action:
mvn clean install;
cd budle;
mvn install pax:provision
Embedding in other projects
To embed Moquette in another maven project is sufficient to include a repository and declare the dependency:
<repositories>
<repository>
<id>bintray</id>
<url>http://dl.bintray.com/andsel/maven/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
Include dependency in your project:
<dependency>
<groupId>org.dna.mqtt</groupId>
<artifactId>moquette-broker</artifactId>
<version>0.6</version>
</dependency>
Build from sources
After a git clone of the repository, cd into the cloned sources and: mvn clean package.
In distribution/target directory will be produced the selfcontained tar for the broker with all dependencies and a running script.
SSL configuration
Here are some simple steps to do to configure Moquette to serve over SSL **Details ** Moquette uses JavaKeyStore? and certificates to handle SSL. In order to expose it over SSL you have create a keystore for the broker (select the password), exporting a certificate and define 4 variables into moquette.conf.
Create a keystore In a directory generate the keystore using the JRE's keytool:
keytool -keystore serverkeystore.jks -alias testserver -genkey -keyalg RSA
To make it work you have to answer at the first question, say moquette.dna.org and as password we could use passw0rdsrv for both (keystore and keymanger)
Export a certificate Then you need export a certificate:
keytool -export -alias testserver -keystore serverkeystore.jks -file testserver.crt
Imporing on the client side Supposing you have already created the keystore for the client side, (name it clientkeystore for example), we could import the certificate with:
keytool -keystore clientkeystore.jks -import -alias testserver -file testserver.crt -trustcacerts
It's done! We just need use the Paho client to connect to the server, check ServerIntegrationSSLTest.java integration test to see how.
Developers resources Google Group https://groups.google.com/forum/#!forum/moquette-mqtt