Format
The canonical form of a PostgreSQL transport address is a schema-qualified quoted identifier:
""table"".""schema""
Only the table name is mandatory. An address containing only a table name is a valid address, e.g. MyTable
.
Resolution
The address is resolved into a fully-qualified table name that includes the table name and its schema.
Schema
The transport needs to determine which schema to use for a queue table when sending messages. The following API sets the schema for an endpoint when using routing to determine the destination queue for a message:
var routing = endpointConfiguration.UseTransport(new PostgreSqlTransport("connectionString"));
routing.RouteToEndpoint(typeof(MyMessage), "MyEndpoint");
routing.UseSchemaForEndpoint(endpointName: "MyEndpoint", schema: "my_schema");
There are several cases when routing is not used and the transport requires specific configuration to determine the schema for a queue table:
- Error queue
- Audit queue
- ServiceControl plugin queues
- Overriding the default routing mechanism
Use the following API to set the schema for a queue:
var transport = new PostgreSqlTransport("connectionString");
transport.Schema.UseSchemaForQueue(queueName: "myqueue", schema: "my_schema");
transport.Schema.UseSchemaForQueue(queueName: "myerror", schema: "sc");
The specified schema is used both when sending to a specific queue, and when a queue is set in endpoint configuration:
await messageSession.Send("myqueue", new MyMessage());
endpointConfiguration.SendFailedMessagesTo("myerror");
If the queue name contains a "." and the first part is not a schema name, enclose the queue name in quotes.
endpointConfiguration.SendHeartbeatTo("\"Particular.ServiceControl\"");
The following values determine the schema, in priority order:
- A schema configured for a given queue via
UseSchemaForQueue
. - A schema configured for a given endpoint via
UseSchemaForEndpoint
. - A schema contained in the destination address.
- A default schema configured via
DefaultSchema
. - Otherwise,
public
is used as a default schema.