Interface PublishInboundOutput
-
- All Superinterfaces:
AsyncOutput<PublishInboundOutput>
,SimpleAsyncOutput<PublishInboundOutput>
@DoNotImplement public interface PublishInboundOutput extends AsyncOutput<PublishInboundOutput>
This is the output parameter of anyPublishInboundInterceptor
providing methods to define the outcome of PUBLISH interception.It can be used to
- Modify an inbound PUBLISH packet
- Prevent delivery of an inbound PUBLISH packet
Only one of the methods
preventPublishDelivery()
may be called.Subsequent calls will fail with an
UnsupportedOperationException
.- Since:
- 4.0.0, CE 2019.1
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description @NotNull Async<PublishInboundOutput>
async(@NotNull Duration timeout, @NotNull TimeoutFallback timeoutFallback, @NotNull AckReasonCode reasonCode)
If the timeout is expired beforeAsync.resume()
is called then the outcome is handled either as failed or successful, depending on the specified fallback.@NotNull Async<PublishInboundOutput>
async(@NotNull Duration timeout, @NotNull TimeoutFallback timeoutFallback, @NotNull AckReasonCode reasonCode, @Nullable String reasonString)
If the timeout is expired beforeAsync.resume()
is called then the outcome is handled either as failed or successful, depending on the specified fallback.@NotNull ModifiablePublishPacket
getPublishPacket()
Use this object to make any changes to the inbound PUBLISH.void
preventPublishDelivery()
Prevent the onward delivery of the PUBLISH packet with reason codeAckReasonCode.SUCCESS
for the PUBACK/PUBREC.void
preventPublishDelivery(@NotNull AckReasonCode reasonCode)
Prevent the onward delivery of the PUBLISH packet withreasonCode
set as reason code in the PUBACK/PUBREC.void
preventPublishDelivery(@NotNull AckReasonCode reasonCode, @Nullable String reasonString)
Prevent the onward delivery of the PUBLISH packet withreasonCode
andreasonString
set as reason code and reason string in the PUBACK/PUBREC respectively.-
Methods inherited from interface com.hivemq.extension.sdk.api.async.AsyncOutput
async
-
Methods inherited from interface com.hivemq.extension.sdk.api.async.SimpleAsyncOutput
async
-
-
-
-
Method Detail
-
getPublishPacket
@NotNull ModifiablePublishPacket getPublishPacket()
Use this object to make any changes to the inbound PUBLISH.- Returns:
- A modifiable publish packet.
- Since:
- 4.0.0, CE 2019.1
-
preventPublishDelivery
void preventPublishDelivery()
Prevent the onward delivery of the PUBLISH packet with reason codeAckReasonCode.SUCCESS
for the PUBACK/PUBREC.- Throws:
UnsupportedOperationException
- When preventPublishDelivery is called more than once.- Since:
- 4.0.0, CE 2019.1
-
preventPublishDelivery
void preventPublishDelivery(@NotNull AckReasonCode reasonCode)
Prevent the onward delivery of the PUBLISH packet withreasonCode
set as reason code in the PUBACK/PUBREC.- Parameters:
reasonCode
- The reason code to sent in PUBACK/PUBREC.- Throws:
UnsupportedOperationException
- When preventPublishDelivery is called more than once.- Since:
- 4.0.0, CE 2019.1
-
preventPublishDelivery
void preventPublishDelivery(@NotNull AckReasonCode reasonCode, @Nullable String reasonString)
Prevent the onward delivery of the PUBLISH packet withreasonCode
andreasonString
set as reason code and reason string in the PUBACK/PUBREC respectively.- Parameters:
reasonCode
- The reason code to sent in PUBACK/PUBREC.reasonString
- The reason string to sent in PUBACK/PUBREC.- Throws:
UnsupportedOperationException
- When preventPublishDelivery is called more than once.- Since:
- 4.0.0, CE 2019.1
-
async
@NotNull Async<PublishInboundOutput> async(@NotNull Duration timeout, @NotNull TimeoutFallback timeoutFallback, @NotNull AckReasonCode reasonCode, @Nullable String reasonString)
If the timeout is expired beforeAsync.resume()
is called then the outcome is handled either as failed or successful, depending on the specified fallback.Do not call this method more than once. If an async method is called multiple times an exception is thrown.
- Parameters:
timeout
- Timeout that HiveMQ waits for the result of the async operation.timeoutFallback
- Fallback behaviour if a timeout occurs.If the fallback is SUCCESS then the publish will be delivered.
If the fallback is FAILURE then the publish will be dropped.
reasonCode
- The reason code sent in PUBACK/PUBREC when timeout occurs.reasonString
- The reason string sent in PUBACK/PUBREC when timeout occurs.- Returns:
- An
Async
object, containing thePublishInboundOutput
. - Throws:
UnsupportedOperationException
- If async is called more than once.- Since:
- 4.0.0, CE 2019.1
-
async
@NotNull Async<PublishInboundOutput> async(@NotNull Duration timeout, @NotNull TimeoutFallback timeoutFallback, @NotNull AckReasonCode reasonCode)
If the timeout is expired beforeAsync.resume()
is called then the outcome is handled either as failed or successful, depending on the specified fallback.Do not call this method more than once. If an async method is called multiple times an exception is thrown.
- Parameters:
timeout
- Timeout that HiveMQ waits for the result of the async operation.timeoutFallback
- Fallback behaviour if a timeout occurs.If the fallback is SUCCESS then the publish will be delivered.
If the fallback is FAILURE then the publish will be dropped.
reasonCode
- The reason code sent in PUBACK/PUBREC when timeout occurs.- Returns:
- An
Async
object, containing thePublishInboundOutput
. - Throws:
UnsupportedOperationException
- If async is called more than once.- Since:
- 4.0.0, CE 2019.1
-
-