/** * Adds a property for the gateway identifier. * <p> * The property will only be added if the value is not {@code null}. * * @param id The gateway identifier. * @return This message for chaining. */ public EventBusMessage setGatewayId(final String id) { setProperty(MessageHelper.APP_PROPERTY_GATEWAY_ID, id); return this; }
/** * Adds a property for the tenant identifier. * <p> * The property will only be added if the value is not {@code null}. * * @param tenantId The tenant identifier. * @return This message for chaining. */ public EventBusMessage setTenant(final String tenantId) { setProperty(MessageHelper.APP_PROPERTY_TENANT_ID, tenantId); return this; }
/** * Adds a property for the device identifier. * <p> * The property will only be added if the value is not {@code null}. * * @param deviceId The device identifier. * @return This message for chaining. */ public EventBusMessage setDeviceId(final String deviceId) { setProperty(MessageHelper.APP_PROPERTY_DEVICE_ID, deviceId); return this; }
/** * Adds a property for the device identifier. * <p> * The property will only be added if the value is not {@code null}. * * @param deviceId The device identifier. * @return This message for chaining. */ public EventBusMessage setDeviceId(final String deviceId) { setProperty(MessageHelper.APP_PROPERTY_DEVICE_ID, deviceId); return this; }
/** * Adds a property for the address that responses to * this (request) message should be sent. * <p> * The property will only be added if the value is not {@code null}. * * @param address The address. * @return This message for chaining. */ public EventBusMessage setReplyToAddress(final String address) { setProperty(MessageHelper.SYS_PROPERTY_REPLY_TO, address); return this; }
/** * Adds a property for the address that responses to * this (request) message should be sent. * <p> * The property will only be added if the value is not {@code null}. * * @param address The address. * @return This message for chaining. */ public EventBusMessage setReplyToAddress(final String address) { setProperty(MessageHelper.SYS_PROPERTY_REPLY_TO, address); return this; }
/** * Adds a property for the request/response payload. * <p> * The property will only be added if the value is not {@code null}. * * @param payload The payload. * @return This message for chaining. */ public EventBusMessage setJsonPayload(final JsonObject payload) { setProperty(RequestResponseApiConstants.FIELD_PAYLOAD, payload); return this; }
/** * Adds a property for the <em>x-opt-app-correlation-id</em> flag. * * @param flag The flag. * @return This message for chaining. */ public EventBusMessage setAppCorrelationId(final boolean flag) { setProperty(MessageHelper.ANNOTATION_X_OPT_APP_CORRELATION_ID, flag); return this; }
/** * Adds a property for the tenant identifier. * <p> * The property will only be added if the value is not {@code null}. * * @param tenantId The tenant identifier. * @return This message for chaining. */ public EventBusMessage setTenant(final String tenantId) { setProperty(MessageHelper.APP_PROPERTY_TENANT_ID, tenantId); return this; }
/** * Adds a property for the request/response payload. * <p> * The property will only be added if the value is not {@code null}. * * @param payload The payload. * @return This message for chaining. */ public EventBusMessage setJsonPayload(final JsonObject payload) { setProperty(RequestResponseApiConstants.FIELD_PAYLOAD, payload); return this; }
/** * Adds a property for the gateway identifier. * <p> * The property will only be added if the value is not {@code null}. * * @param id The gateway identifier. * @return This message for chaining. */ public EventBusMessage setGatewayId(final String id) { setProperty(MessageHelper.APP_PROPERTY_GATEWAY_ID, id); return this; }
/** * Adds a property for the <em>x-opt-app-correlation-id</em> flag. * * @param flag The flag. * @return This message for chaining. */ public EventBusMessage setAppCorrelationId(final boolean flag) { setProperty(MessageHelper.ANNOTATION_X_OPT_APP_CORRELATION_ID, flag); return this; }
/** * Creates a new (response) message for a status code. * * @param status The status code indicating the outcome of the operation. * @return The response message. */ public static EventBusMessage forStatusCode(final int status) { final EventBusMessage result = new EventBusMessage(new JsonObject()); result.setProperty(MessageHelper.APP_PROPERTY_STATUS, status); return result; }
/** * Creates a new (response) message for a status code. * * @param status The status code indicating the outcome of the operation. * @return The response message. */ public static EventBusMessage forStatusCode(final int status) { final EventBusMessage result = new EventBusMessage(new JsonObject()); result.setProperty(MessageHelper.APP_PROPERTY_STATUS, status); return result; }
/** * Adds a property for the correlation identifier. * <p> * The property will only be added if the value is not {@code null}. * * @param id The correlation identifier. * @return This message for chaining. * @throws IllegalArgumentException if the identifier is neither a {@code String} * nor an {@code UnsignedLong} nor a {@code UUID} nor a {@code Binary}. */ public EventBusMessage setCorrelationId(final Object id) { setProperty(MessageHelper.SYS_PROPERTY_CORRELATION_ID, encodeIdToJson(id)); return this; }
/** * Adds a property for the correlation identifier. * <p> * The property will only be added if the value is not {@code null}. * * @param id The correlation identifier. * @return This message for chaining. * @throws IllegalArgumentException if the identifier is neither a {@code String} * nor an {@code UnsignedLong} nor a {@code UUID} nor a {@code Binary}. */ public EventBusMessage setCorrelationId(final Object id) { setProperty(MessageHelper.SYS_PROPERTY_CORRELATION_ID, encodeIdToJson(id)); return this; }
/** * Adds a property for the cache directive. * <p> * The property will only be added if the value is not {@code null}. * * @param directive The cache directive. * @return This message for chaining. */ public EventBusMessage setCacheDirective(final CacheDirective directive) { if (directive != null) { setProperty( MessageHelper.APP_PROPERTY_CACHE_CONTROL, Objects.requireNonNull(directive).toString()); } return this; }
/** * Adds a property for the <em>x-opt-app-correlation-id</em> flag. * <p> * The property will be set to the value of the corresponding annotation * from the AMQP message or to {@code false}, if the message doesn't * contain a corresponding annotation. * * @param message The AMQP message to retrieve the value from. * @return This message for chaining. */ public EventBusMessage setAppCorrelationId(final Message message) { setProperty( MessageHelper.ANNOTATION_X_OPT_APP_CORRELATION_ID, MessageHelper.getXOptAppCorrelationId(message)); return this; }
/** * Adds a property for the cache directive. * <p> * The property will only be added if the value is not {@code null}. * * @param directive The cache directive. * @return This message for chaining. */ public EventBusMessage setCacheDirective(final CacheDirective directive) { if (directive != null) { setProperty( MessageHelper.APP_PROPERTY_CACHE_CONTROL, Objects.requireNonNull(directive).toString()); } return this; }
/** * Adds a property with a value from an AMQP message. * <p> * The property will only be added if the AMQP message contains * a non-{@code null} <em>application property</em> of the given name. * * @param name The name of the property. * @param msg The AMQP message to retrieve the value from. * @return This message for chaining. */ public EventBusMessage setStringProperty(final String name, final Message msg) { setProperty(name, MessageHelper.getApplicationProperty( msg.getApplicationProperties(), name, String.class)); return this; }