ContextFactory Class

Solclient

ContextFactory Class
version: 7.2.1.27
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: 7.2.1.27 (7.2.1.27)
    Syntax
    public sealed class ContextFactory
    Public NotInheritable Class ContextFactory
    public ref class ContextFactory sealed

    The ContextFactory type exposes the following members.

    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.

    For SolOS Version 4.4, only exclusive Queues are supported on an appliance with a CRB (Content Routing Blade). 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.

    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 methodCreateSubscriberEndpoint
    Creates a Subscriber Endpoint.

    A Subscriber Endpoint is a holding area which allows a subscriber to attract Guaranteed messages matching the subscriptions set registered for that subscriber.

    Subscriber Endpoints are durable. Therefore matching messages can still accumulate on the Subscriber Endpoint even if the subscriber that added the subscriptions is offline.

    To consume messages from the given Subscriber Endpoint, client applications must create a Flow using CreateFlow(...) on ISession passing in the corresponding ISubscriberEndpoint Endpoint. There is one Subscriber Endpoint for each provisioned subscriber on the appliance.

    For SolOS Version 4.4, Subscriber Endpoints are only supported on appliances with a Content Routing Blade (CRB).

    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.)
    Protected methodFinalize
    Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
    (Inherited from Object.)
    Public methodGetHashCode
    Serves as a hash function for a particular type.
    (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.
    Protected methodMemberwiseClone
    Creates a shallow copy of the current Object.
    (Inherited from Object.)
    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
    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
    See Also