Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3336224
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T00:06:36+00:00 2026-05-18T00:06:36+00:00

We’re using TIBCO EMS from our ASP.NET 3.5 app for one interface to an

  • 0

We’re using TIBCO EMS from our ASP.NET 3.5 app for one interface to an external system, and it appears to be working just fine – except that the guys running the other side tells us we’re racking up connections like crazy and never closing them….

What I’m doing is routing all TIBCO traffic through a single class with static member variables for both the TIBCO ConnectionFactory and the Connection itself, having been told that constructing them is pretty resource- and time-intensive:

private static ConnectionFactory Factory
{
    get
    {
        if (HttpContext.Current.Application["EMSConnectionFactory"] == null)
        {
           ConnectionFactory connectionFactory = CreateTibcoFactory();
           HttpContext.Current.Application["EMSConnectionFactory"] = connectionFactory;
        }

        return HttpContext.Current.Application["EMSConnectionFactory"] as ConnectionFactory;
    }
}

private static Connection EMSConnection
{
    get
    {
        if (HttpContext.Current.Application["EMSConnection"] == null)
        {
           Connection connection = Factory.CreateConnection(*username*,  *password*);
           connection.ExceptionHandler += new EMSExceptionHandler(TibcoConnectionExceptionHandler);
           connection.Start();
           HttpContext.Current.Application["EMSConnection"] = connection;
        }

        return HttpContext.Current.Application["EMSConnection"] as Connection;
     }
 }

Now my trouble is: where and how could I

  • tell the TIBCO connection to “auto-close” when no longer needed (like with the SqlConnection)
  • close the TIBCO connection on an error
  • close the TIBCO connection before our ASP.NET app finishes (or the user logs off)

I don’t really seem to find much useful information on how to use TIBCO EMS from the C# / .NET world…… any takers?? Thanks!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T00:06:36+00:00Added an answer on May 18, 2026 at 12:06 am

    Firstly, I don’t understand how you could be running out of connections. Since you’re storing the connection in the application, you should only have a single connection for the entire IIS application.

    That put aside, I would do the following:

    • When the connection is retrieved, create the connection as you do now;
    • After you’ve created the connection, spin up a background thread;
    • Set a DateTime to DateTime.Now;
    • Let the background check (e.g. every second or every 10 seconds) what the difference is between the date you’ve set and DateTime.Now. If that’s longer than a specific timeout, kill the connection and set Application["EMSConnectionFactory"] to null;
    • When the background thread kills the connection, close the background thread;
    • Every time the connection gets requested, reset the DateTimetoDateTime.Now`.

    This way, the connections should be closed automatically.

    Note that you will have to introduce locking. You can use Application.Lock() and Application.Unlock() for this.

    Concerning closing on an error: I see that you’ve attached an exception handler to the connection instance. Can’t you close the connection with that?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We're building an app, our first using Rails 3, and we're having to build
I'm making a simple page using Google Maps API 3. My first. One marker
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
In order to apply a triggered animation to all ToolTip s in my app,
Does anyone know how can I replace this 2 symbol below from the string
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a bunch of posts stored in text files formatted in yaml/textile (from
I want use html5's new tag to play a wav file (currently only supported

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.