propertiesBuilder.appId(JsonFormat.printToString(serviceRef));
public static AMQP.BasicProperties fromJson( JsonObject json ) { if ( json == null ) { return new AMQP.BasicProperties(); } return new AMQP.BasicProperties.Builder() .contentType(json.getString("contentType")) .contentEncoding(json.getString("contentEncoding")) .headers(asMap(json.getJsonObject("headers"))) .deliveryMode(json.getInteger("deliveryMode")) .priority(json.getInteger("priority")) .correlationId(json.getString("correlationId")) .replyTo(json.getString("replyTo")) .expiration(json.getString("expiration")) .messageId(json.getString("messageId")) .timestamp(parseDate(json.getString("timestamp"))) .type(json.getString("type")) .userId(json.getString("userId")) .appId(json.getString("appId")) .clusterId(json.getString("clusterId")).build(); }
correlationId(correlationId). userId(userId). appId(appId). type(type). timestamp(timestamp).
properties.appId(appId.toString());
propsBuilder.appId(appId);
propsBuilder.appId(appId);
builder.appId(message.getApp_id());
private Observable<RxRabbitTests.PublishedMessage> sendNMessagesAsync(int numMessages, int offset, RabbitPublisher publisher) { final List<Observable<RxRabbitTests.PublishedMessage>> sendCallbacks = new ArrayList<>(); log.infoWithParams("Scheduling messages to rabbit", "numMessages", numMessages); for (int it = 1 ; it<=numMessages; it++) { final int id = it+offset; String messageId = String.valueOf(it); sendCallbacks.add( publisher.call( new Exchange(inputExchange), new RoutingKey("routing"), new AMQP.BasicProperties.Builder() .appId("send-messages") .messageId(messageId) .deliveryMode(DeliveryMode.persistent.code) .headers(new HashMap<>()) .build(), new Payload(messageId.getBytes())) .map(aVoid -> new RxRabbitTests.PublishedMessage(id, false)) .onErrorReturn(throwable -> { log.errorWithParams("Failed message.", throwable); return new RxRabbitTests.PublishedMessage(id, true); }) .toObservable()); } return Observable.merge(sendCallbacks); }
BasicProperties create(final Message message) { final Builder builder = new Builder(); builder.appId(toStr(message.properties().get(AppId.name())));
@Override public BasicProperties fromMessageProperties(final MessageProperties source, final String charset) { BasicProperties.Builder target = new BasicProperties.Builder(); target.headers(this.convertHeadersIfNecessary(source.getHeaders())) .timestamp(source.getTimestamp()) .messageId(source.getMessageId()) .userId(source.getUserId()) .appId(source.getAppId()) .clusterId(source.getClusterId()) .type(source.getType()); MessageDeliveryMode deliveryMode = source.getDeliveryMode(); if (deliveryMode != null) { target.deliveryMode(MessageDeliveryMode.toInt(deliveryMode)); } target.expiration(source.getExpiration()) .priority(source.getPriority()) .contentType(source.getContentType()) .contentEncoding(source.getContentEncoding()); String correlationId = source.getCorrelationId(); if (StringUtils.hasText(correlationId)) { target.correlationId(correlationId); } String replyTo = source.getReplyTo(); if (replyTo != null) { target.replyTo(replyTo); } return target.build(); }
@Override public BasicProperties fromMessageProperties(final MessageProperties source, final String charset) { BasicProperties.Builder target = new BasicProperties.Builder(); target.headers(this.convertHeadersIfNecessary(source.getHeaders())) .timestamp(source.getTimestamp()) .messageId(source.getMessageId()) .userId(source.getUserId()) .appId(source.getAppId()) .clusterId(source.getClusterId()) .type(source.getType()); MessageDeliveryMode deliveryMode = source.getDeliveryMode(); if (deliveryMode != null) { target.deliveryMode(MessageDeliveryMode.toInt(deliveryMode)); } target.expiration(source.getExpiration()) .priority(source.getPriority()) .contentType(source.getContentType()) .contentEncoding(source.getContentEncoding()); String correlationId = source.getCorrelationId(); if (StringUtils.hasText(correlationId)) { target.correlationId(correlationId); } String replyTo = source.getReplyTo(); if (replyTo != null) { target.replyTo(replyTo); } return target.build(); }
private Observable<PublishedMessage> sendNMessagesAsync(int numMessages, int offset, RabbitPublisher publisher) { final List<Observable<PublishedMessage>> sendCallbacks = new ArrayList<>(); log.infoWithParams("Scheduling messages to rabbit", "numMessages", numMessages); for (int it = 1; it <= numMessages; it++) { final int id = it + offset; String messageId = String.valueOf(it); sendCallbacks.add( publisher.call( new Exchange(inputExchange), new RoutingKey("routing"), new AMQP.BasicProperties.Builder() .appId("send-messages") .messageId(messageId) .deliveryMode(DeliveryMode.persistent.code) .headers(new HashMap<>()) .build(), new Payload(messageId.getBytes())) .map(aVoid -> new PublishedMessage(id, false)) .onErrorReturn(throwable -> { log.errorWithParams("Failed message.", throwable); return new PublishedMessage(id, true); }) .toObservable()); } return Observable.merge(sendCallbacks); }
/** * Method is called by ExecutorService and publishes message on RabbitMQ * * @return loggingEvent */ @Override public LoggingEvent call() throws Exception { if(zafiraConnected) { String payload = layout.format(loggingEvent); AMQP.BasicProperties.Builder b = new AMQP.BasicProperties().builder(); b.appId(identifier) .type(loggingEvent.getLevel().toString()) .correlationId(String.valueOf(correlationId)) .contentType("text/json"); createChannel().basicPublish(exchange, routingKey, b.build(), payload.getBytes()); } return loggingEvent; } }
/** * Method is called by ExecutorService and publishes message on RabbitMQ * * @return loggingEvent */ @Override public LoggingEvent call() throws Exception { if(zafiraConnected) { String payload = layout.format(loggingEvent); AMQP.BasicProperties.Builder b = new AMQP.BasicProperties().builder(); b.appId(identifier) .type(loggingEvent.getLevel().toString()) .correlationId(String.valueOf(correlationId)) .contentType("text/json"); createChannel().basicPublish(exchange, routingKey, b.build(), payload.getBytes()); } return loggingEvent; } }
public static AMQP.BasicProperties box(Message msg) { AMQP.BasicProperties.Builder builder = new AMQP.BasicProperties.Builder(); return builder.messageId(String.valueOf(msg.getMessageId())) .appId(msg.getAppId()) .clusterId(msg.getClusterId()) .contentEncoding(msg.getContentEncoding()) .contentType(msg.getContentType()) .correlationId(msg.getCorrelationId()) .deliveryMode((int) msg.getDeliveryMode()) .expiration(msg.getExpiration()) .headers(msg.getHeaders()) .priority((int) msg.getPriority()) .replyTo(msg.getReplyTo()) .timestamp(new Date(msg.getTimestamp())) .type(msg.getType()) .userId(msg.getUserId()) .build(); }
public BasicProperties toBasicProperties() { BasicProperties.Builder builder = new BasicProperties.Builder(); return builder.appId(appId).clusterId(clusterId).contentEncoding(contentEncoding).contentType(contentType).correlationId(correlationId) .deliveryMode(deliveryMode).expiration(expiration).headers(headers).messageId(messageId).priority(priority).replyTo(replyTo) .timestamp(timestamp).type(type).userId(userId).build(); }