Class PublishMessageCommandImpl
- All Implemented Interfaces:
CommandWithCommunicationApiStep<PublishMessageCommandStep1>,CommandWithTenantStep<PublishMessageCommandStep1.PublishMessageCommandStep3>,CommandWithVariables<PublishMessageCommandStep1.PublishMessageCommandStep3>,FinalCommandStep<PublishMessageResponse>,PublishMessageCommandStep1,PublishMessageCommandStep1.PublishMessageCommandStep2,PublishMessageCommandStep1.PublishMessageCommandStep3
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.camunda.client.api.command.PublishMessageCommandStep1
PublishMessageCommandStep1.PublishMessageCommandStep2, PublishMessageCommandStep1.PublishMessageCommandStep3 -
Field Summary
Fields inherited from class io.camunda.client.impl.command.CommandWithVariables
objectMapperFields inherited from interface io.camunda.client.api.command.CommandWithTenantStep
DEFAULT_TENANT_IDENTIFIER -
Constructor Summary
ConstructorsConstructorDescriptionPublishMessageCommandImpl(GatewayGrpc.GatewayStub asyncStub, CamundaClientConfiguration configuration, JsonMapper jsonMapper, Predicate<CredentialsProvider.StatusCode> retryPredicate, HttpClient httpClient, boolean preferRestOverGrpc) -
Method Summary
Modifier and TypeMethodDescriptioncorrelationKey(String correlationKey) Set the value of the correlation key of the message.Set the id of the message.messageName(String messageName) Set the name of the message.requestTimeout(Duration requestTimeout) Sets the request timeout for the command.send()Sends the command to the Camunda gateway.protected PublishMessageCommandImplsetVariablesInternal(String variables) Specifies the tenant that will own any entities (e.g. process definition, process instances, etc.) resulting from this command, or that owns any entities (e.g. jobs) referred to from this command.timeToLive(Duration timeToLive) Set the time-to-live of the message.useGrpc()Experimental: This method is under development, and as such using it may have no effect on the command builder when called.useRest()Experimental: This method is under development, and as such using it may have no effect on the command builder when called.Skip specifying a correlation key for the message.Methods inherited from class io.camunda.client.impl.command.CommandWithVariables
variable, variables, variables, variables, variables
-
Constructor Details
-
PublishMessageCommandImpl
public PublishMessageCommandImpl(GatewayGrpc.GatewayStub asyncStub, CamundaClientConfiguration configuration, JsonMapper jsonMapper, Predicate<CredentialsProvider.StatusCode> retryPredicate, HttpClient httpClient, boolean preferRestOverGrpc)
-
-
Method Details
-
setVariablesInternal
- Specified by:
setVariablesInternalin classCommandWithVariables<PublishMessageCommandImpl>
-
messageId
Description copied from interface:PublishMessageCommandStep1.PublishMessageCommandStep3Set the id of the message. The message is rejected if another message is already published with the same id, name and correlation-key.- Specified by:
messageIdin interfacePublishMessageCommandStep1.PublishMessageCommandStep3- Parameters:
messageId- the id of the message- Returns:
- the builder for this command. Call
FinalCommandStep.send()to complete the command and send it to the broker.
-
timeToLive
Description copied from interface:PublishMessageCommandStep1.PublishMessageCommandStep3Set the time-to-live of the message. The message can only be correlated within the given time-to-live.If the duration is zero or negative then the message can only be correlated to open subscriptions (e.g. to an entered message catch event).
If no duration is set then the default is used from the configuration.
- Specified by:
timeToLivein interfacePublishMessageCommandStep1.PublishMessageCommandStep3- Parameters:
timeToLive- the time-to-live of the message- Returns:
- the builder for this command. Call
FinalCommandStep.send()to complete the command and send it to the broker.
-
correlationKey
Description copied from interface:PublishMessageCommandStep1.PublishMessageCommandStep2Set the value of the correlation key of the message.This value will be used together with the message name to find matching message subscriptions.
- Specified by:
correlationKeyin interfacePublishMessageCommandStep1.PublishMessageCommandStep2- Parameters:
correlationKey- the correlation key value of the message- Returns:
- the builder for this command
-
withoutCorrelationKey
Description copied from interface:PublishMessageCommandStep1.PublishMessageCommandStep2Skip specifying a correlation key for the message.This method allows the message to be published without a correlation key, making it suitable for scenarios where the correlation key is not necessary (e.g. for the message start event). When used, this will create a new process instance without checking for an active instance with the same correlation key.
- Specified by:
withoutCorrelationKeyin interfacePublishMessageCommandStep1.PublishMessageCommandStep2- Returns:
- the builder for this command, continuing to the next step without a correlation key.
-
messageName
Description copied from interface:PublishMessageCommandStep1Set the name of the message.- Specified by:
messageNamein interfacePublishMessageCommandStep1- Parameters:
messageName- the name of the message- Returns:
- the builder for this command
-
tenantId
Description copied from interface:CommandWithTenantStepSpecifies the tenant that will own any entities (e.g. process definition, process instances, etc.) resulting from this command, or that owns any entities (e.g. jobs) referred to from this command.Multi-tenancy
Multiple tenants can share a Camunda cluster. Entities can be assigned to a specific tenant using an identifier. Only that tenant can access these entities.
Any entities created before multi-tenancy has been enabled in the Camunda cluster, are assigned to the
CommandWithTenantStep.DEFAULT_TENANT_IDENTIFIER.If no tenant is explicitly specified, then the command is rejected.
- Specified by:
tenantIdin interfaceCommandWithTenantStep<PublishMessageCommandStep1.PublishMessageCommandStep3>- Parameters:
tenantId- the identifier of the tenant to specify for this command, e.g."ACME"- Returns:
- the builder for this command with the tenant specified
-
requestTimeout
Description copied from interface:FinalCommandStepSets the request timeout for the command. The default request timeout can be configured usingCamundaClientBuilder.defaultRequestTimeout(Duration).- Specified by:
requestTimeoutin interfaceFinalCommandStep<PublishMessageResponse>- Parameters:
requestTimeout- the request timeout- Returns:
- the configured command
-
send
Description copied from interface:FinalCommandStepSends the command to the Camunda gateway. This operation is asynchronous. In case of success, the future returns the event that was generated by the Camunda gateway in response to the command.Call
CamundaFuture.join()to wait until the response is available.Future<JobEventinvalid input: '>' future = command.send(); JobEvent event = future.join();- Specified by:
sendin interfaceFinalCommandStep<PublishMessageResponse>- Returns:
- a future tracking state of success/failure of the command.
-
useRest
Description copied from interface:CommandWithCommunicationApiStepExperimental: This method is under development, and as such using it may have no effect on the command builder when called. While unimplemented, it simply returns the command builder instance unchanged. This method already exists for software that is building support for a REST API in Camunda, and already wants to use this API during its development. As support for REST is added to Camunda, each of the commands that implement this method may start to take effect. Until this warning is removed, anything described below may not yet have taken effect, and the interface and its description are subject to change.Sets REST as the communication API for this command. If this command doesn't support communication over REST, it simply returns the command builder instance unchanged. The default communication API can be configured using
CamundaClientBuilder.preferRestOverGrpc(boolean).- Specified by:
useRestin interfaceCommandWithCommunicationApiStep<PublishMessageCommandStep1>- Returns:
- the configured command
-
useGrpc
Description copied from interface:CommandWithCommunicationApiStepExperimental: This method is under development, and as such using it may have no effect on the command builder when called. While unimplemented, it simply returns the command builder instance unchanged. This method already exists for software that is building support for a REST API in Camunda, and already wants to use this API during its development. As support for REST is added to Zeebe, each of the commands that implement this method may start to take effect. Until this warning is removed, anything described below may not yet have taken effect, and the interface and its description are subject to change.Sets gRPC as the communication API for this command. If this command doesn't support communication over gRPC, it simply returns the command builder instance unchanged. The default communication API can be configured using
CamundaClientBuilder.preferRestOverGrpc(boolean).- Specified by:
useGrpcin interfaceCommandWithCommunicationApiStep<PublishMessageCommandStep1>- Returns:
- the configured command
-