コード例 #1
0
 private PublishMessage generatePublishMessage() {
   PublishMessage publishMessage =
       (PublishMessage) MessageFactory.getMessageInstance(MessageType.PUBLISH);
   publishMessage
       .setTopic(publishTopic)
       .setMessageId(Math.abs(new Random().nextInt()))
       .setPayload(new RandomSentenceGenerator().generate(new Random().nextInt(19) + 1));
   return publishMessage;
 }
コード例 #2
0
 private ConnectMessage generateConnectMessage() {
   ConnectMessage connectMessage =
       (ConnectMessage) MessageFactory.getMessageInstance(MessageType.CONNECT);
   connectMessage.setId(Math.abs(new Random().nextInt()));
   return connectMessage;
 }