Package org.eclipse.hono.util
Class BaseMessageFilter
- java.lang.Object
-
- org.eclipse.hono.util.BaseMessageFilter
-
public class BaseMessageFilter extends Object
A basic filter for checking existence and correctness of mandatory message properties.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
BaseMessageFilter()
Empty default constructor.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description protected static boolean
hasCorrelationId(org.apache.qpid.proton.message.Message msg)
Checks if an AMQP message contains either a message ID or a correlation ID.protected static boolean
hasValidDeviceId(ResourceIdentifier linkTarget, org.apache.qpid.proton.message.Message msg)
Checks if an AMQP message contains a valid device identifier.protected static boolean
verifyStandardProperties(ResourceIdentifier linkTarget, org.apache.qpid.proton.message.Message msg)
Checks whether an AMQP message contains required standard properties.
-
-
-
Method Detail
-
verifyStandardProperties
protected static final boolean verifyStandardProperties(ResourceIdentifier linkTarget, org.apache.qpid.proton.message.Message msg)
Checks whether an AMQP message contains required standard properties.This method checks if the message contains a valid device identifier using the
hasValidDeviceId(ResourceIdentifier, Message)
method.After successful verification the following properties are added to the message's annotations:
MessageHelper.APP_PROPERTY_DEVICE_ID
- the ID of the device that reported the data.MessageHelper.APP_PROPERTY_TENANT_ID
- the ID of the tenant as indicated by the link target's second segment.MessageHelper.APP_PROPERTY_RESOURCE
- the full resource path including the endpoint, the tenant and the device ID.
- Parameters:
linkTarget
- The resource path to check the message's properties against for consistency.msg
- The AMQP 1.0 message to perform the checks on.- Returns:
true
if the message passes all checks.
-
hasValidDeviceId
protected static final boolean hasValidDeviceId(ResourceIdentifier linkTarget, org.apache.qpid.proton.message.Message msg)
Checks if an AMQP message contains a valid device identifier.- Parameters:
linkTarget
- The resource path to check the message's properties against for consistency.msg
- The AMQP 1.0 message to perform the checks on.- Returns:
true
if the following conditions are met:- The message contains an application property
MessageHelper.APP_PROPERTY_DEVICE_ID
. - If the link target contains a resource ID, it matches the ID from the property.
- The message contains an application property
-
hasCorrelationId
protected static final boolean hasCorrelationId(org.apache.qpid.proton.message.Message msg)
Checks if an AMQP message contains either a message ID or a correlation ID.- Parameters:
msg
- The message.- Returns:
true
if the message has an ID that can be used for correlation.
-
-