Open davsclaus opened 3 years ago
Here is the OSGi export for the v3 bundle JAR with version 1.2.5
Export-Package: org.eclipse.paho.client.mqttv3;version="1.2.5",org.ecl
ipse.paho.client.mqttv3.logging;version="1.2.5",org.eclipse.paho.clie
nt.mqttv3.persist;version="1.2.5",org.eclipse.paho.client.mqttv3.util
;version="1.2.5"
I would also like this to be addressed. We are using the org.eclipse.paho.mqttv5.common.MqttException, which seems like a common use case.
Ideally the jar would list all the public packages. Something like this?
Export-Package: org.eclipse.paho.mqttv5.client;version="1.2.5",org.ecl
ipse.paho.mqttv5.common;version="1.2.5",org.eclipse.paho.mqttv5.commo
n.util;version="1.2.5",org.eclipse.paho.mqttv5.client.logging;version
="1.2.5",org.eclipse.paho.mqttv5.client.persist;version="1.2.5",org.e
clipse.paho.mqttv5.client.spi;version="1.2.5",org.eclipse.paho.mqttv5
.client.util;version="1.2.5"
~/.m2/repository/org/apache/camel/karaf/apache-camel/3.9.0/apache-camel-3.9.0-features.xml
<!-- paho v5 does not work in OSGi: https://github.com/eclipse/paho.mqtt.java/issues/857 -->
<feature name='camel-paho-mqtt5' version='3.9.0' start-level='50'>
<feature version='3.9.0'>camel-core</feature>
<bundle>mvn:org.eclipse.paho/org.eclipse.paho.mqttv5.client/1.2.5</bundle>
<bundle>mvn:org.apache.camel/camel-paho-mqtt5/3.9.0</bundle>
</feature>
feature:list | grep camel-paho-mqtt5
in Apache-Karaf.~/.m2/repository/org/eclipse/paho/org.eclipse.paho.mqttv5.client/1.2.5
. You need to modify this file ./META-INF/MANIFEST.MF in that jar as stated in the comments above. For example: Download Fixed Jar
Manifest-Version: 1.0
Bundle-SymbolicName: org.eclipse.paho.mqttv5.client
Bundle-ManifestVersion: 2
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Bundle-Vendor: Paho
Import-Package: javax.net;resolution:=optional,javax.net.ssl;resolutio
n:=optional
Export-Package: org.eclipse.paho.mqttv5.client;version="1.2.5",
org.eclipse.paho.mqttv5.common;version="1.2.5",
org.eclipse.paho.mqttv5.common.nls;version="1.2.5",
org.eclipse.paho.mqttv5.common.packet;version="1.2.5",
org.eclipse.paho.mqttv5.common.packet.util;version="1.2.5",
org.eclipse.paho.mqttv5.common.util;version="1.2.5",
org.eclipse.paho.mqttv5.client.internal;version="1.2.5",
org.eclipse.paho.mqttv5.client.internal.nls;version="1.2.5",
org.eclipse.paho.mqttv5.client.logging;version="1.2.5",
org.eclipse.paho.mqttv5.client.persist;version="1.2.5",
org.eclipse.paho.mqttv5.client.security;version="1.2.5",
org.eclipse.paho.mqttv5.client.spi;version="1.2.5",
org.eclipse.paho.mqttv5.client.util;version="1.2.5",
org.eclipse.paho.mqttv5.client.websocket;version="1.2.5",
org.eclipse.paho.mqttv5.client.wire;version="1.2.5"
Bundle-Name: Paho Mqtt Client
Bundle-Version: 1.2.5
Bundle-Localization: bundle
Build-Jdk-Spec: 1.8
Created-By: Maven Archiver 3.5.0
feature:install camel-paho-mqtt5
Here is an example for OSGi Blueprint
Consumer
<?xml version="1.0" encoding="UTF-8"?>
<blueprint
xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0
http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
<camelContext xmlns="http://camel.apache.org/schema/blueprint">
<route>
<from uri="paho-mqtt5:topic_demo?brokerUrl=tcp://<your_ip>:1883&clientId=xxxId&qos=2"/>
<log message="[Consumer] Receive message from MQTT Server:"/>
<log message=" HEADERS = ${headers}"/>
<log message=" MESSAGE = ${body}"/>
</route>
</camelContext>
- Producer
```xml
<?xml version="1.0" encoding="UTF-8"?>
<blueprint
xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0
http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
<camelContext xmlns="http://camel.apache.org/schema/blueprint">
<route>
<!-- Start Jetty HTTP Server -->
<from uri="jetty:http://0.0.0.0:8080/produce"/>
<convertBodyTo type="java.lang.String"/>
<setProperty name="jsonObj">
<jsonpath>$</jsonpath>
</setProperty>
<log message="[Producer] Send message to MQTT Server: "/>
<log message=" MESSAGE = ${exchangeProperty.jsonObj}"/>
<!-- Remove HTTP header information -->
<removeHeaders pattern="*"/>
<to uri="paho-mqtt5:topic_demo?brokerUrl=tcp://<your_ip>:1883&clientId=xxxId&qos=2"/>
</route>
</camelContext>
</blueprint>
Please fill out the form below before submitting, thank you!
We are having a new paho mqtt v5 camel component and for our OSGi support then we noticed that the bundle JAR only exports
As we use the memory persistence in the persist sub package then OSGi imports fails.
I wonder if you can make the bundle JAR export its sub packages - or if they are really not for end users, then mark them as private packages in the bundle JAR manifest, then its more obvious to know.