Interface MessageMapping<T extends org.eclipse.hono.util.ExecutionContext>

  • Type Parameters:
    T - The type of execution context supported by this mapping service.
    All Known Implementing Classes:
    HttpBasedMessageMapping

    public interface MessageMapping<T extends org.eclipse.hono.util.ExecutionContext>
    A service for either processing messages uploaded by devices before they are being forwarded downstream or mapping payload for commands to be sent to devices.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      io.vertx.core.Future<MappedMessage> mapDownstreamMessage​(T ctx, org.eclipse.hono.util.ResourceIdentifier targetAddress, org.eclipse.hono.util.RegistrationAssertion registrationInfo)
      Maps a message uploaded by a device.
      io.vertx.core.Future<io.vertx.core.buffer.Buffer> mapUpstreamMessage​(org.eclipse.hono.util.RegistrationAssertion registrationInfo, org.eclipse.hono.client.command.Command command)
      Maps a command to be sent to a device/gateway.
    • Method Detail

      • mapDownstreamMessage

        io.vertx.core.Future<MappedMessage> mapDownstreamMessage​(T ctx,
                                                                 org.eclipse.hono.util.ResourceIdentifier targetAddress,
                                                                 org.eclipse.hono.util.RegistrationAssertion registrationInfo)
        Maps a message uploaded by a device.

        If a mapping service is not configured for a gateway or a protocol adapter, this method returns a successful future containing the original device payload and target address. If a mapping service is configured for a gateway or a protocol adapter and the mapping service returns a 200 OK HTTP status code, then this method returns a successful future containing the mapped payload.

        For all other 2XX HTTP status codes, this method returns a mapped message containing the original device payload and target address. In all other cases, this method returns a failed future with a ServiceInvocationException.

        Parameters:
        ctx - The context in which the message has been uploaded.
        targetAddress - The downstream address that the message will be forwarded to.
        registrationInfo - The information included in the registration assertion for the authenticated device that has uploaded the message.
        Returns:
        A successful future containing the mapped message. Otherwise, the future will be failed with a ServiceInvocationException if the message could not be mapped.
        Throws:
        NullPointerException - if any of the parameters are null.
      • mapUpstreamMessage

        io.vertx.core.Future<io.vertx.core.buffer.Buffer> mapUpstreamMessage​(org.eclipse.hono.util.RegistrationAssertion registrationInfo,
                                                                             org.eclipse.hono.client.command.Command command)
        Maps a command to be sent to a device/gateway.

        If a command mapping service is not configured for a gateway or a protocol adapter, this method returns a successful future containing the original command payload. If a command mapping service is configured for a gateway or a protocol adapter and the mapping service returns a 200 OK HTTP status code, then this method returns a successful future containing the mapped command.

        For all other 2XX HTTP status codes, this method returns the original command payload. In all other cases, this method returns a failed future with a ServiceInvocationException.

        Parameters:
        registrationInfo - The information included in the registration assertion for the gateway/device to which the command needs to be sent.
        command - The original command to be mapped.
        Returns:
        A successful future containing the mapped command. Otherwise, the future will be failed with a ServiceInvocationException if the command could not be mapped.
        Throws:
        NullPointerException - if any of the parameters are null.