Try PubSub+

How to create ISubscription instance to be used by Session.CreateFlow method in .NET API

I am trying to create a subscriber for my durable topic endpoint in solace via .NET APIs.
I have the below method where in I am trying to create a flow for my durable topic endpoint. I don't understand what is the need for ISubscription instance in the Session.CreateFlow method. (https://docs.solace.com/API-Developer-Online-Ref-Documentation/net/html/a548a98a-9134-c167-2517-192a26ceed77.htm)

How do I create an instance of ISubscription and what should it be?

public void Start()
        {
            //Create a instance of a durable topic endpoint
            topic = ContextFactory.Instance.CreateDurableTopicEndpointEx(topicName);

            FlowProperties flowProps = new FlowProperties();
            flowProps.FlowStartState = false;
            if (selector != null)
            {
                flowProps.Selector = selector;
            }
            flowProps.AckMode = ackMode == AckMode.ClientAcknowledge ? MessageAckMode.ClientAck : MessageAckMode.AutoAck;
            if (windowSize.HasValue)
            {
                flowProps.WindowSize = windowSize.Value;
            }
            flow = session.CreateFlow(flowProps, topic, null, HandleFlowMessageEvent, HandleFlowEvent);
            flow.Start();
        }  

I am currently passing it as null and I get the error subscription must be non-null when endpoint is of type ITopicEndpoint

Sign In or Register to comment.