Fixed Hazelcast itnegration tests, removing unusefull thread sleeps, but more important permitting the co existence of 2 Brokers in the same JVM
This commit is contained in:
@@ -15,18 +15,16 @@ public class HazelcastInterceptHandler extends AbstractInterceptHandler {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(HazelcastInterceptHandler.class);
|
||||
private final HazelcastInstance hz;
|
||||
|
||||
|
||||
public HazelcastInterceptHandler (Server server){
|
||||
this.hz = server.getHazelcastInstance();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onPublish(InterceptPublishMessage msg) {
|
||||
LOG.info(String.format("%s publish on %s message : %s\n", msg.getClientID(), msg.getTopicName(), new String(msg.getPayload().array())));
|
||||
LOG.info("{} publish on {} message: {}", msg.getClientID(), msg.getTopicName(), new String(msg.getPayload().array()));
|
||||
ITopic<HazelcastMsg> topic = hz.getTopic("moquette");
|
||||
HazelcastMsg hazelcastMsg = new HazelcastMsg(msg.getClientID(),msg.getTopicName(), msg.getQos().byteValue(), msg.getPayload().array(), msg.getUsername());
|
||||
HazelcastMsg hazelcastMsg = new HazelcastMsg(msg.getClientID(), msg.getTopicName(), msg.getQos().byteValue(),
|
||||
msg.getPayload().array(), msg.getUsername());
|
||||
topic.publish(hazelcastMsg);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import java.io.Serializable;
|
||||
/**
|
||||
* Created by mackristof on 28/05/2016.
|
||||
*/
|
||||
public class HazelcastMsg implements Serializable{
|
||||
public class HazelcastMsg implements Serializable {
|
||||
|
||||
private final String clientId;
|
||||
private final String userName;
|
||||
@@ -13,7 +13,7 @@ public class HazelcastMsg implements Serializable{
|
||||
private final byte[] payload;
|
||||
private final String topic;
|
||||
|
||||
public HazelcastMsg(String clientId, String topic , byte qos, byte[] payload, String userName) {
|
||||
public HazelcastMsg(String clientId, String topic, byte qos, byte[] payload, String userName) {
|
||||
this.clientId = clientId;
|
||||
this.qos = qos;
|
||||
this.payload = payload;
|
||||
@@ -21,7 +21,6 @@ public class HazelcastMsg implements Serializable{
|
||||
this.topic = topic;
|
||||
}
|
||||
|
||||
|
||||
public String getClientId() {
|
||||
return clientId;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user