KubeMQ
IntegrationsMassTransitReference

Configuration Reference

The MassTransit.KubeMQ transport options POCO, validation rules, appsettings binding, host URI scheme, channel naming, and header/tag mapping.

The complete configuration reference for the MassTransit.KubeMQ transport: package facts, the KubeMQTransportOptions POCO and its validation, appsettings.json binding, the kubemq:// host URI scheme, channel naming, header/tag mapping, and the observability instruments. Every value here is taken from the transport source. For the configurator method surface, see API; for exceptions, see Error codes.

Package

FactValue
NuGet PackageIdMassTransit.KubeMQ
Version1.0.0
Target frameworknet8.0
MassTransit dependency>= 8.5.0
LicenseApache-2.0
Repositorygithub.com/kubemq-io/kubemq-masstransit
terminal
dotnet add package MassTransit.KubeMQ

The package depends on MassTransit with the version range [8.5.0,) and references the KubeMQ C# SDK (KubeMQ.Sdk). XML documentation is generated (GenerateDocumentationFile), so the configurator members surface as IntelliSense in your IDE.

KubeMQTransportOptions

KubeMQTransportOptions is the central configuration POCO. It is bindable to IOptions<T> and appsettings.json, and is passed via the configureOptions callback of UsingKubeMQ. The transport uses separate Host/Port properties for ergonomics and bridges them to the SDK's single Address string internally as {Host}:{Port}.

Prop

Type

Validation

KubeMQTransportOptions.Validate() runs automatically during bus startup and throws KubeMQTransportConfigurationException for any invalid value. The exact messages are listed under Error codes.

PropertyRule
HostNon-empty / non-whitespace
Port165535
PollTimeoutSeconds13600
MaxPollMessages11024
ConnectionTimeout> TimeSpan.Zero
ReconnectTimeout> TimeSpan.Zero

Binding from appsettings.json

ConnectionTimeout and ReconnectTimeout are TimeSpan values, so they use the "hh:mm:ss" string format.

appsettings.json
{
  "KubeMQ": {
    "Host": "kubemq-server.example.com",
    "Port": 50000,
    "AuthToken": "my-token",
    "UseTls": false,
    "PollTimeoutSeconds": 10,
    "MaxPollMessages": 64,
    "DefaultCqMode": "Queries",
    "ConnectionTimeout": "00:00:30",
    "ReconnectTimeout": "00:02:00"
  }
}
Program.cs
services.AddMassTransit(x =>
{
    x.UsingKubeMQ((ctx, cfg) =>
    {
        cfg.Host("kubemq-server.example.com", 50000);

        cfg.ReceiveEndpoint("orders", e =>
        {
            e.ConfigureKubeMQ(t => { });
        });
    }, options =>
    {
        options.MaxPollMessages = 64;
        options.PollTimeoutSeconds = 10;
    });
});

For the full walkthrough of every way to supply configuration, see the Configuration guide.

Host URI scheme

The Host(Uri) overload and send addresses use the kubemq:// scheme.

Connection URI

kubemq://host:port?authToken=<token>&tls=<true|false>
Query parameterMeaning
authTokenAuthentication token
tlstrue or false to enable/disable TLS
Program.cs
cfg.Host(new Uri("kubemq://kubemq-server:50000?authToken=my-token&tls=true"));

Send address

Send endpoints address a specific channel by path. The queue: shorthand resolves to the same channel:

kubemq://host:port/channel-name
Program.cs
// Full scheme
var endpoint = await bus.GetSendEndpoint(new Uri("kubemq://kubemq-server:50000/order-processing"));

// queue: shorthand
var endpoint = await bus.GetSendEndpoint(new Uri("queue:order-processing"));
await endpoint.Send(new SubmitOrder { OrderId = "123" });

Channel naming

KubeMQ channel names are derived from MassTransit endpoint and message-type names. The : character is replaced with . (so Namespace:Type becomes Namespace.Type), and IEndpointNameFormatter conventions (PascalCase, kebab-case, snake_case) are respected.

ContextPatternExample
Send endpointQueue name from URI pathqueue:order-processingorder-processing
Publish endpointMessage type full nameMyApp.Events.OrderSubmitted
Consumer endpointEndpoint name (auto or manual)order-consumer
Error channel{channel}_errororder-processing_error
Skipped channel{channel}_skippedorder-processing_skipped
Priority high{channel}_highorder-processing_high
Priority normal{channel}_normalorder-processing_normal
Priority low{channel}_loworder-processing_low
Consumer groupSame as endpoint nameorder-consumer

Header and tag mapping

MassTransit envelope headers are mapped to KubeMQ Tags with the MT- prefix. Custom user headers use the MT-Header-{name} form.

MassTransit HeaderKubeMQ TagDescription
MessageIdMT-MessageIdUnique message identifier
CorrelationIdMT-CorrelationIdCorrelation for related messages
ConversationIdMT-ConversationIdConversation tracking
RequestIdMT-RequestIdRequest/response correlation
InitiatorIdMT-InitiatorIdMessage initiator
SourceAddressMT-SourceAddressSending endpoint address
DestinationAddressMT-DestinationAddressTarget endpoint address
ResponseAddressMT-ResponseAddressResponse endpoint address
FaultAddressMT-FaultAddressFault handling address
ContentTypeMT-ContentTypeSerialization content type
SentTimeMT-SentTimeISO 8601 send timestamp
ExpirationTimeMT-ExpirationTimeISO 8601 expiration (from TTL)
MessageTypeMT-MessageTypeSupported message types (;-separated)
Custom headersMT-Header-{name}User-defined headers

Trace context tags

W3C OpenTelemetry trace context is propagated automatically via two tags, integrating with MassTransit's ActivitySource ("MassTransit") for end-to-end distributed tracing:

TagMaps to
MT-TraceParentW3C traceparent header
MT-TraceStateW3C tracestate header

Fault tags

When a message is faulted (after all retries are exhausted) and routed to {channel}_error, fault metadata is stored as tags:

TagDescription
MT-Fault-ExceptionTypeException type name
MT-Fault-MessageException message
MT-Fault-StackTraceException stack trace
MT-Fault-TimestampWhen the fault occurred
MT-Fault-RetryCountNumber of retry attempts before faulting

Observability instruments

Metrics

The transport exposes instruments under the MassTransit.KubeMQ meter (version 1.0.0). Add the meter to your OpenTelemetry pipeline with AddMeter("MassTransit.KubeMQ") to collect them.

InstrumentTypeUnitDescription
kubemq.transport.poll.durationHistogrammsDuration of queue poll operations
kubemq.transport.poll.messagesHistogrammessagesMessages received per poll batch
kubemq.transport.poll.emptyCounterpollsCount of empty poll responses
kubemq.transport.send.durationHistogrammsDuration of queue send operations
kubemq.transport.publish.durationHistogrammsDuration of publish operations
kubemq.transport.errorsCountererrorsTransport-level error count

Health states

The transport maps the KubeMQ SDK ConnectionState to MassTransit health status. MassTransit registers these health checks automatically; expose them with app.MapHealthChecks("/health").

KubeMQ StateMassTransit HealthMeaning
ReadyHealthyConnection is active and operational
ConnectingDegradedInitial connection in progress
ReconnectingDegradedLost connection, attempting to reconnect
ClosedUnhealthyConnection permanently closed
IdleUnhealthyNot connected

The KubeMQConnectionContextSupervisor exposes the same state via IsReady (Ready), IsDegraded (Connecting or Reconnecting), and IsUnhealthy (Closed or Idle) for programmatic checks.

For wiring up health, traces, and metrics end-to-end, see the Observability guide.

See also

Was this page helpful?

On this page