Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ public final class PahoConstants {

@Deprecated
public static final String HEADER_ORIGINAL_MESSAGE = "PahoOriginalMessage";
public static final String CAMEL_PAHO = "CamelPaho";
public static final String CAMEL_PAHO_MSG_QOS = CAMEL_PAHO + "Qos";
public static final String CAMEL_PAHO_MSG_RETAINED = CAMEL_PAHO + "Retained";


private PahoConstants() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ public PahoProducer(PahoEndpoint endpoint) {
public void process(Exchange exchange) throws Exception {
MqttClient client = getEndpoint().getClient();
String topic = getEndpoint().getTopic();
int qos = getEndpoint().getQos();
boolean retained = getEndpoint().isRetained();

int qos = exchange.getIn().getHeader(PahoConstants.CAMEL_PAHO_MSG_QOS, getEndpoint().getQos(), Integer.class);
boolean retained = exchange.getIn().getHeader(PahoConstants.CAMEL_PAHO_MSG_RETAINED, getEndpoint().isRetained(), Boolean.class);

byte[] payload = exchange.getIn().getBody(byte[].class);

MqttMessage message = new MqttMessage(payload);
Expand All @@ -41,9 +43,11 @@ public void process(Exchange exchange) throws Exception {
client.publish(topic, message);
}



@Override
public PahoEndpoint getEndpoint() {
return (PahoEndpoint) super.getEndpoint();
return (PahoEndpoint)super.getEndpoint();
}

}
}