When attempting to subscribe to topics via the wildcard “>” using a temporary queue via the C# API, I am getting a “503 - unknown queue” error. I haven’t tried to use temporary queues before and I’m not sure what the problem is.
As a troubleshooting step I tried creating a durable queue instead using ContextFactory.CreateQueue(). My existing code (working for a few years now) does that.
But in this project, when I try that I get a different error, and I’m not sure why I’m getting this either. As far as I can see all of my solace configuration code is the same in both projects, but the documentation mentions that the .NET API “doesn’t support redelivery delay” anyway, so I don’t understand why it’s required here, but not in my previous projects.
Error creating solace objects: Failed to create a flow instanceOperation Error: ReturnCode = SOLCLIENT_FAIL Error Info: (Subcode=ControlOther, Error string=Redelivery delay support required, Response code= 403 )SolaceSystems.Solclient.Messaging.OperationErrorException: Failed to create a flow instance
Temporary endpoints are only provisioned then there is an active consumer. In this case a flow.
Here some source based on existing code,
// 1. Connect the session
_session = _context.CreateSession(props, null, OnSessionEvent);
rc = _session.Connect();
if (rc != ReturnCode.SOLCLIENT_OK)
throw new Exception($"Failed to connect session: {rc}");
// 2. Create the local temporary queue handle
// NOTE: This does not provision the queue on the broker yet.
IQueue queue = _session.CreateTemporaryQueue("monitorqueue");
// 3. Configure flow properties — explicitly start in STOPPED state
FlowProperties flowProps = new FlowProperties
{
FlowStartState = false, // false = stopped (true is the default)
AckMode = MessageAckMode.AutoClientAck, // or ClientAck for manual ack
};
// 4. Create the stopped flow — this provisions the temporary endpoint on the
// broker AND binds the consumer to it in one operation.
IFlow flow = _session.CreateFlow(
flowProps,
queue, // endpoint to bind to (and provision)
null, // no initial topic subscription via flow
OnMessage, // MessageEventArgs handler
OnFlowEvent // FlowEventArgs handler
);
// At this point the temporary queue EXISTS on the broker.
// 5. Now subscribe a topic to the provisioned queue.
ITopic topic = ContextFactory.Instance.CreateTopic(">");
rc = _session.Subscribe(queue, topic, SubscribeFlag.WaitForConfirm, null);
if (rc != ReturnCode.SOLCLIENT_OK)
throw new Exception($"Failed to subscribe topic to queue, return code {rc}");
// 6. Start the flow — message delivery begins now.
flow.Start();
Note temporary endpoints are de-provisioned broker once the flow is closed as well. As the lifecycle of the endpoint is tied to the consuming flow.
The 503 error indicates your local queue handle from IQueue queue = _session.CreateTemporaryQueue("monitorqueue"); does not exist so it can not add a subscription to a non-existent queue.
This due to binding to a redelivery enable queue with a consuming flow. Either configure by cli or queue templates (via matching queue name pattern) on the broker. Redelivery Delay configuration on queue is only support on select SMF clients and SMF .NET client does not support Redelivery Delay configuration on queues.
Thanks, changing the order of operations such that the flow is created before the subscription is created solved the unknown queue issue.
The “Redelivery delay support required” problem is very curious, because I have other programs reading from this broker without error using essentially the same code, I have not changed anything about our broker configuration, and I was certainly not going to the broker management portal to change the queue properties after creating it in my troubleshooting process. But all of that came out of troubleshooting and is not really related to the original issue. Hopefully I can just ignore it since the project I am working on in the context of this forum thread now works, and all of the previous projects are still working. But it does make me a bit uneasy. If I need to delve into that further I will start a new forum thread.