@Override public void push(Request request) { if (request.getBody() == null) { throw new NullPointerException("Request body must not be null."); } request.setReplyTo(replyToTopic); client.push(ProxyMessageBuilder.notification(new NotificationCreatePayload(requestTopic, gson.toJson(request)))); // toDo: use request partition key }
@Override public void push(Request request) { if (request.getBody() == null) { throw new NullPointerException("Request body must not be null."); } request.setReplyTo(replyToTopic); client.push(ProxyMessageBuilder.notification(new NotificationCreatePayload(requestTopic, gson.toJson(request)))); // toDo: use request partition key }
@Override public void push(Request request) { if (request.getBody() == null) { throw new NullPointerException("Request body must not be null."); } request.setReplyTo(replyToTopic); client.push(ProxyMessageBuilder.notification( new NotificationCreatePayload(requestTopic, gson.toJson(request), request.getPartitionKey()))); }
@Override public void push(Request request) { if (request.getBody() == null) { throw new NullPointerException("Request body must not be null."); } request.setReplyTo(replyToTopic); requestProducer.send(new ProducerRecord<>(requestTopic, request.getPartitionKey(), request), (recordMetadata, e) -> { if (e != null) { logger.error("Send request failed", e); requestResponseMatcher.removeRequestCallback(request.getCorrelationId()); } logger.debug("Request {} sent successfully", request.getCorrelationId()); //TODO [rafa] in case sending fails - we need to notify the caller using the callback passed. }); }
@Override public void onEvent(ServerEvent serverEvent) throws Exception { final Request request = serverEvent.get(); if (request.getBody() == null) { throw new NullPointerException("Request body must not be null."); } request.setReplyTo(replyToTopic); proxyClient.push(ProxyMessageBuilder.notification( new NotificationCreatePayload(requestTopic, gson.toJson(request), request.getPartitionKey()))); } }
private void pingServer() { Request request = Request.newBuilder().build(); request.setReplyTo(replyToTopic); request.setType(RequestType.ping); boolean connected = false;
private List<Response> createCommandSubscription(PluginSubscribeRequest body, boolean returnUpdated) { return body.getFilters().stream() .map(filter -> { filter.setEventName(COMMAND_EVENT.name()); CommandSubscribeRequest commandSubscribeRequest = new CommandSubscribeRequest(body.getSubscriptionId(), filter, body.getNames(), null, returnUpdated, 0); Request commandRequest = Request.newBuilder() .withBody(commandSubscribeRequest) .withSingleReply(false) .build(); commandRequest.setReplyTo(body.getTopicName()); return commandSubscribeRequestHandler.handle(commandRequest); }).collect(toList()); }
private List<Response> createNotificationSubscription(PluginSubscribeRequest body) { return body.getFilters().stream() .map(filter -> { filter.setEventName(NOTIFICATION_EVENT.name()); NotificationSubscribeRequest notificationSubscribeRequest = new NotificationSubscribeRequest( body.getSubscriptionId(), filter, body.getNames(), null); Request notificationRequest = Request.newBuilder() .withBody(notificationSubscribeRequest) .withSingleReply(false) .build(); notificationRequest.setReplyTo(body.getTopicName()); return notificationSubscribeRequestHandler.handle(notificationRequest); }).collect(toList()); }
private void pingServer() { Request request = Request.newBuilder().build(); request.setReplyTo(replyToTopic); request.setType(RequestType.ping); boolean connected = false;
private Response removeCommandSubscription(PluginUnsubscribeRequest body) { CommandUnsubscribeRequest commandUnsubscribeRequest = new CommandUnsubscribeRequest(ImmutableSet.of(body.getSubscriptionId())); Request commandRequest = Request.newBuilder() .withBody(commandUnsubscribeRequest) .withSingleReply(false) .build(); commandRequest.setReplyTo(body.getTopicName()); return commandUnsubscribeRequestHandler.handle(commandRequest); }
private void pingServer() { Request request = Request.newBuilder().build(); request.setReplyTo(replyToTopic); request.setType(RequestType.ping); boolean connected = false;
private Response removeNotificationSubscription(PluginUnsubscribeRequest body) { NotificationUnsubscribeRequest notificationUnsubscribeRequest = new NotificationUnsubscribeRequest(ImmutableSet.of(body.getSubscriptionId())); Request notificationRequest = Request.newBuilder() .withBody(notificationUnsubscribeRequest) .withSingleReply(false) .build(); notificationRequest.setReplyTo(body.getTopicName()); return notificationUnsubscribeRequestHandler.handle(notificationRequest); }
private void pingServer() { Request request = Request.newBuilder().build(); request.setReplyTo(replyToTopic); request.setType(RequestType.ping); boolean connected = false;