10.27.03

ContextFactory Class

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.
  • Definition

    Namespace: SolaceSystems.Solclient.Messaging
    Assembly: SolaceSystems.Solclient.Messaging (in SolaceSystems.Solclient.Messaging.dll) Version: 10.27.0
    C#
    public sealed class ContextFactory
    Inheritance
    Object    ContextFactory

    Properties

    Contexts Returns a read-only list of of active (that is, not yet disposed) contexts created by this Factory.
    Instance A Singleton accessor.

    Methods

    Cleanup 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.

    CreateClientName Creates a representation of a remote client endpoint, which can be used to add/remove subscriptions on behalf of that client.
    CreateContext Creates a new IContext instance.
    CreateDurableTopicEndpoint Deprecated, please use CreateDurableTopicEndpointEx(String) instead.
    Obsolete.
    CreateDurableTopicEndpointEx 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).

    CreateMessage Creates an IMessage instance. Applications are responsible for disposing all messages allocated by this method as soon as they are done with them.
    CreateQueue(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.

    CreateQueue(String, String)

    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.


    Obsolete.
    CreateReplicationGroupMessageId 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.
    CreateSubscriberEndpoint Deprecated.
    CreateTopic(String) Creates a non-temporary Topic with the given name.
    CreateTopic(TopicProperties) Creates a non-temporary ITopic instance given a TopicProperties.
    CreateTopic(String, Boolean) Creates a non-temporary ITopic instance.

    The optional "receiveAllDeliverToOne" boolean is deprecated. Applications should use shared subscriptions to distribute published messages across multiple consumers. Then the publisher never need to set 'DeliverToOne' and this override is not necessary.

    CreateXpe Creates an Xpath expression (XPE) with the specified parameters.
    EqualsDetermines whether the specified object is equal to the current object.
    (Inherited from Object)
    GetHashCodeServes as the default hash function.
    (Inherited from Object)
    GetLastSDKErrorInfo 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.

    GetMessageLevelStat Returns the value of the specified message level statistic.
    GetQuantaLevelStat Returns the value of the specified quanta level statistic.
    GetTypeGets the Type of the current instance.
    (Inherited from Object)
    GetVersion 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)
    Init 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.
    SetLogLevel 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.
    ToStringReturns a string that represents the current object.
    (Inherited from Object)

    Fields

    NUM_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

    See Also