@Test public void testPublishAsync() throws Exception { WeEvent weEvent = new WeEvent(this.topicName, "hello world".getBytes(StandardCharsets.UTF_8), this.extensions); SendResult sendResult = this.weEventClient.publishAsync(weEvent).get(this.transactionTimeout, TimeUnit.SECONDS); Assert.assertEquals(sendResult.getStatus(), SendResult.SendResultStatus.SUCCESS); Assert.assertFalse(sendResult.getEventId().isEmpty()); }
@Override public CompletableFuture<SendResult> publishAsync(WeEvent weEvent) throws BrokerException { validateWeEvent(weEvent); log.info("start to publish event by async: {}", weEvent); TopicContent weEventTopic = new TopicContent(weEvent.getTopic()); weEventTopic.setGroupId(this.groupId); checkConnected(); return this.transport.stompSendAsync(weEventTopic, weEvent); }
WeEventClient implements IWeEventClient { @Override public CompletableFuture<SendResult> publishAsync(WeEvent weEvent) throws BrokerException { validateWeEvent(weEvent); log.info("start to publish event by async: {}", weEvent); TopicContent weEventTopic = new TopicContent(weEvent.getTopic()); weEventTopic.setGroupId(this.groupId); checkConnected(); return this.transport.stompSendAsync(weEventTopic, weEvent); } }
WeEventClient implements IWeEventClient { @Override public CompletableFuture<SendResult> publishAsync(WeEvent weEvent) throws BrokerException { validateWeEvent(weEvent); log.info("start to publish event by async: {}", weEvent); TopicContent weEventTopic = new TopicContent(weEvent.getTopic()); weEventTopic.setGroupId(this.groupId); checkConnected(); return this.transport.stompSendAsync(weEventTopic, weEvent); } WeEventClient(String brokerUrl, String groupId, String userName, String password, int timeout); }
WeEventClient implements IWeEventClient { @Override public CompletableFuture<SendResult> publishAsync(WeEvent weEvent) throws BrokerException { validateWeEvent(weEvent); log.info("start to publish event by async: {}", weEvent); TopicContent weEventTopic = new TopicContent(weEvent.getTopic()); weEventTopic.setGroupId(this.groupId); checkConnected(); return this.transport.stompSendAsync(weEventTopic, weEvent); } WeEventClient(String brokerUrl, String groupId, String userName, String password, int timeout); @Override boolean unSubscribe(String subscriptionId); @Override boolean open(String topic); @Override boolean close(String topic); @Override boolean exist(String topic); @Override TopicPage list(Integer pageIndex, Integer pageSize); @Override TopicInfo state(String topic); @Override WeEvent getEvent(String eventId); @Override SendResult publish(WeEvent weEvent); @Override CompletableFuture<SendResult> publishAsync(WeEvent weEvent); @Override String subscribe(String topic, String offset, Map<String, String> extension, @NonNull EventListener listener); @Override String subscribe(String[] topics, String offset, Map<String, String> extension, @NonNull EventListener listener); static SSLContext getSSLContext(); }
WeEventClient implements IWeEventClient { @Override public CompletableFuture<SendResult> publishAsync(WeEvent weEvent) throws BrokerException { validateWeEvent(weEvent); log.info("start to publish event by async: {}", weEvent); TopicContent weEventTopic = new TopicContent(weEvent.getTopic()); weEventTopic.setGroupId(this.groupId); checkConnected(); return this.transport.stompSendAsync(weEventTopic, weEvent); } WeEventClient(String brokerUrl, String groupId, String userName, String password, int timeout); @Override boolean unSubscribe(String subscriptionId); @Override boolean open(String topic); @Override boolean close(String topic); @Override boolean exist(String topic); @Override TopicPage list(Integer pageIndex, Integer pageSize); @Override TopicInfo state(String topic); @Override WeEvent getEvent(String eventId); @Override SendResult publish(WeEvent weEvent); @Override CompletableFuture<SendResult> publishAsync(WeEvent weEvent); @Override String subscribe(String topic, String offset, Map<String, String> extension, @NonNull EventListener listener); @Override String subscribe(String[] topics, String offset, Map<String, String> extension, @NonNull EventListener listener); static SSLContext getSSLContext();  }