Click or drag to resize

ContextFactory Class

version: 10.21.0
ContextFactory is a singleton which represents the first point of contact or entry point to the APIs. It has the following responsibilities:
  • Exposes the initialization and cleanup routines. API initialization is required before using any of its components.
  • Acts as a factory of the different components of the API, such as contexts, messages, non-temporary destinations, durable endpoint instances, and subscriptions.
  • Exposes a number of useful statistics at the message and memory pool levels.
  • Exposes logging facilities to enable client applications to receive log events and control the log level.
  • Inheritance Hierarchy
    SystemObject
      SolaceSystems.Solclient.MessagingContextFactory

    Namespace:  SolaceSystems.Solclient.Messaging
    Assembly:  SolaceSystems.Solclient.Messaging (in SolaceSystems.Solclient.Messaging.dll) Version: 10.21.0
    Syntax
    C#
    public sealed class ContextFactory

    The ContextFactory type exposes the following members.

    Properties
      NameDescription
    Public propertyContexts
    Returns a read-only list of of active (that is, not yet disposed) contexts created by this Factory.
    Public propertyStatic memberInstance
    A Singleton accessor.
    Top
    Methods
      NameDescription
    Public methodCleanup
    This method may be called after use of the API is completed.

    This method takes care of any global clean-up that might be required. It automatically frees all allocated resources, including those for Contexts and Sessions that have been previously created but are not destroyed. Note that if Cleanup() is called while sessions are connected, any messages buffered for transmission are discarded and not sent. In most applications, it is not necessary to call ContextFactory.Cleanup() as the resources in use are automatically recovered when the application exits. ContextFactory.Cleanup() exists for rare applications that may want recover all API resources and continue operating without using the API further.

    Public methodCreateClientName
    Creates a representation of a remote client endpoint, which can be used to add/remove subscriptions on behalf of that client.
    Public methodCreateContext
    Creates a new IContext instance.
    Public methodCreateDurableTopicEndpoint Obsolete.
    Deprecated, please use CreateDurableTopicEndpointEx(String) instead.
    Public methodCreateDurableTopicEndpointEx
    Creates a representation of a durable Topic Endpoint (DTE) in the API.

    A DTE is a holding area which allows a subscriber to attract Guaranteed messages matching a given Topic subscription. Durable means that the subscriber that is bound to the given DTE, does not have to be online to attract matching messages.

    This method does not provision the DTE on the appliance. The represented DTE must be first provisioned on the appliance before any use by the API. Applications are able to provision DTEs on the appliance using Provision(IEndpoint, EndpointProperties, Int32, Object) where capability ENDPOINT_MANAGEMENT exists. The name parameter is the name given to the Topic Endpoint when provisioning it on the appliance. Applications can call Provision(IEndpoint, EndpointProperties, Int32, Object) to provision it on the appliance.

    To consume messages from a given DTE, client applications must create a Flow using CreateFlow(...) on ISession passing in the corresponding DTE. Also, there can be only one active flow per DTE.

    DTEs are only supported on appliances with an Assured Delivery Blade (ADB).

    Public methodCreateMessage
    Creates an IMessage instance. Applications are responsible for disposing all messages allocated by this method as soon as they are done with them.
    Public methodCreateQueue(String)
    Creates a representation of a durable/non-temporary Queue in the API.

    Before creating a IFlow instance to a durable Queue on the appliance, the queue must be first provisioned. Applications can provision durable/non-temporary queues using Provision(IEndpoint, EndpointProperties, Int32, Object).

    Applications can send or receive Guaranteed messages from a Queue, messages received on a Queue have a single consumer. Multiple subscribing clients can listen for messages on the same Queue, but once any client retrieves a particular message from the Queue and acknowledges it, that message is consumed and is no longer available to other potential subscribing clients. To consume messages from a Queue, client applications must create a Flow using CreateFlow(...) on ISession passing in the corresponding IQueue instance.

    An exclusive Queue can have multiple active flows at any given time, but only one flow in the set of bound flows can actually consume messages. If the currently consuming flow is closed, one of the standby flows take over and start consuming messages from that Queue.

    A non-exclusive Queue can also have multiple active flows at any given time, but all flows in the set of bound flows can consume messages. Messages are forwarded to bound flows by the appliance in a round-robin fashion. If an application does not consume the message (does not acknowledge it), then when that application closes the flow, or exits, all non-consumed messages are re-delivered, in a round-robin fashion, to any flows still currently bound.

    Public methodCreateQueue(String, String) Obsolete.

    Note: This method is obsolete, and its usage with appliances running SolOS Version 5.4 and greater is strongly discouraged. Applications should use CreateQueue(String) instead.

    Creates a representation of a durable/non-temporary queue in the API, given its name and the Virtual Router Name of the hosting appliance.

    Before creating a IFlow instance to a durable queue on the appliance, the queue must be first provisioned. Applications can provision durable/non-temporary queues using Provision(IEndpoint, EndpointProperties, Int32, Object).

    Applications can send or receive Guaranteed messages from a Queue, messages received on a Queue have a single consumer. Multiple subscribers can listen for messages on the same Queue, but once any subscriber retrieves a particular message from the Queue and acknowledge it, that message is consumed and is no longer available to other potential subscribers. To consume messages from a Queue, client applications must create a Flow using CreateFlow(...) on ISession passing in the corresponding IQueue instance.

    Public methodCreateReplicationGroupMessageId
    Create an Replication Group Message Id object from a string. A IReplicationGroupMessageId is a IReplayStartLocation instance that when set in ReplayStartLocationEx indicates that only messages spooled in the replay log after the given IReplicationGroupMessageId should be replayed.
    Public methodCreateSubscriberEndpoint
    Deprecated.
    Public methodCreateTopic(String)
    Creates a non-temporary Topic with the given name.
    Public methodCreateTopic(TopicProperties)
    Creates a non-temporary ITopic instance given a TopicProperties.

    IsReceiveAllDeliverToOne specifies the DTO behavior.

    Public methodCreateTopic(String, Boolean)
    Creates a non-temporary ITopic instance with the option to set receive-all-deliver-to-one flag.

    This flag, when set on a Topic subscription, overrides the DeliverToOne message property. If the Topic in the message matches, it is delivered to clients with matching subscriptions with the ReceiveAllDeliverToOne set, in addition to being round-robined amongst clients subscribed to the Topic without this override.

    Public methodCreateXpe
    Creates an Xpath expression (XPE) with the specified parameters.
    Public methodEquals
    Determines whether the specified object is equal to the current object.
    (Inherited from Object.)
    Public methodGetHashCode
    Serves as the default hash function.
    (Inherited from Object.)
    Public methodGetLastSDKErrorInfo
    Returns a SDKErrorInfo instance, which contains the last captured error information for the calling thread. This information is captured on a per-thread basis. The returned structure is only valid until the thread makes the next API call.

    This method is typically invoked from within event delegates (Session and Flow), to get more info on the reported event.

    Public methodGetMessageLevelStat
    Returns the value of the specified message level statistic.
    Public methodGetQuantaLevelStat
    Returns the value of the specified quanta level statistic.
    Public methodGetType
    Gets the Type of the current instance.
    (Inherited from Object.)
    Public methodGetVersion
    Returns version information. ContextFactory.Instance.Init(...) must be called before invoking this method, otherwise the NativeSolClient library version information will be missing (IVersion.Native* properties)
    Public methodInit
    Initializes the Messaging API. This method must be called at least once, before using any of the messaging APIs. Typically ContextFactory.Init() is called once during program initialization. One property of interest is LogDelegate, it allows client applications to receive API log information.
    Public methodSetLogLevel
    Change the log level in the native API. When the logging level is high, more messages and strings are generated. Each generated log must be marshalled across the native Interop layer, so setting high log levels like SolLogLevel.Debug can cause poor messaging performance.
    Public methodToString
    Returns a string that represents the current object.
    (Inherited from Object.)
    Top
    Fields
      NameDescription
    Public fieldStatic memberNUM_MSG_QUANTA
    The number of message size quanta available. Useful when calling GetQuantaLevelStat(QuantaLevelStatistic, Int32) to anchor the "quantaIndex" argument to NUM_MSG_QUANTA-1
    Top
    See Also