none
3270 SessionDisplay Connecton Pooling For Screen Scraping using BizTalk orchesrtations exposed as WCF services RRS feed

  • Question

  • I am using Microsoft.HostIntegration.SNA.Session with following code for screen scraping (using 3270 emulator, Mainframe/CICS screen and TCP protocol) and this c# component is used inside the Biztalk orchesrtartion and the orchestration is exposed as wcf services.

    SessionDisplay tmpScreenDisplay = new SessionDisplay();
    SessionConnectionDisplay TN3270Display = new SessionConnectionDisplay();
    TN3270Display.DeviceType = TNDeviceType.IBM3278Model2E;
    TN3270Display.Transport = SessionDisplayTransport.TN3270;
    TN3270Display.TN3270Port = 23;
    TN3270Display.TN3270Server = MAINFRAME_SERVER_IPADDRESS;
    tmpScreenDisplay.Connect(TN3270Display);
    tmpScreenDisplay.WaitForSession(SessionDisplayWaitType.Active, 2000);
    tmpScreenDisplay.WaitForContent(@"Enter the code for the application you wish to access", 2000);
    creenData screendata = tmpScreenDisplay.GetScreenData(22, 3, 14);
    string  strscreendata = _HostConverter.ConvertEbcdicToUnicode(screendata.Data);


    The above code is working fine with multiple concurrent WCF calls from the client and seems to be working fine without any issue.
    But "tmpScreenDisplay.Connect(TN3270Display);" is always taking 4 Seconds or greater to get connected.

    So I decided to create a c# custom 3270 SessionDisplay  connection pool along with the custom session component by storing already connected SessionDisplay object into a static list (with required logic).

    While running the application, I noticed that the application is working fine (with 1.2 seconds) by using the custom pool only if the concurrent wcf calls are below 20 (approximately). If it is above 20 (approximately) then some of these sessions are getting timed out ( and I can see these requests inside the BizTalk admin console as active which cannot be terminated or suspended).

    If I am running the application without custom pool it is working perfect even for more than 100 concurrent wcf calls (but each of these connections are taking more than 4 or more sec ).



    Is there a way can I use a session display connection from a pool so that the subsequent WCF calls can re-use the existing display connection to reduce the response time (without timeout issues)



    Thanks Vinod


    Thursday, November 7, 2013 12:53 AM

Answers

  • We have had some customers create their own connection pooling for use with Session Integrator. You didn't indicate which version of HIS that you are using but it should be HIS 2009 or later. In fact, HIS 2013 might be the best option. A lot of changes went into Session Integrator in HIS 2013. Unfortunately, there really isn't much documentation that outlines the changes. Some of the key work was on the managed code interfaces.

    With that said with HIS 2009 and HIS 2010 (not sure if this still all applies to HIS 2013), you can do the following when trying to use pooling and multi-threaded applications:

    • ALL of the following are done on the same thread, using only a SessionDisplay object instance
          o SD - Connect (“Connection String”)
          o SD - “Work”
          o SD - Disconnect
    • Using both SessionDisplay and associated SessionConnectionDisplay objects
          o On Some Thread
               - SD – Connect (“Connection String”)
               - SCD = SD.Connection
               - SD - Disconnect
          o Then on ANY thread, multiple times
               - SD = new SessionDisplay(SCD)
               - SD – “Work”
               - SD - Disconnect
           o Whenever you are done, on ANY thread
               - SCD - Dispose

    Thanks...


    Stephen Jackson - MSFT

    Thursday, November 7, 2013 3:42 PM

All replies

  • We have had some customers create their own connection pooling for use with Session Integrator. You didn't indicate which version of HIS that you are using but it should be HIS 2009 or later. In fact, HIS 2013 might be the best option. A lot of changes went into Session Integrator in HIS 2013. Unfortunately, there really isn't much documentation that outlines the changes. Some of the key work was on the managed code interfaces.

    With that said with HIS 2009 and HIS 2010 (not sure if this still all applies to HIS 2013), you can do the following when trying to use pooling and multi-threaded applications:

    • ALL of the following are done on the same thread, using only a SessionDisplay object instance
          o SD - Connect (“Connection String”)
          o SD - “Work”
          o SD - Disconnect
    • Using both SessionDisplay and associated SessionConnectionDisplay objects
          o On Some Thread
               - SD – Connect (“Connection String”)
               - SCD = SD.Connection
               - SD - Disconnect
          o Then on ANY thread, multiple times
               - SD = new SessionDisplay(SCD)
               - SD – “Work”
               - SD - Disconnect
           o Whenever you are done, on ANY thread
               - SCD - Dispose

    Thanks...


    Stephen Jackson - MSFT

    Thursday, November 7, 2013 3:42 PM
  • Thanks Stephen..

    I am currently using BizTalk 2010 and HIS 2010, while starting the project HIS 2013 was not released, so we went for 2010.

    For the client (using proxy) is calling BizTalk exposed wcf service asynchronously multiple times by multiple users.(wcf exposed via orchestration and the orchestration in turn calling the session scraping code in a c# class).  Here I am planning to hold the connection (not disconnecting after each call) in a static variable (inside List) so that each one of the WCF calls can reuse the existing connection (if it is connected else will create a new connection).  

    I will try out your logic and see it is working..

    Great help.

    Thanks and regards


    Thanks Vinod

    Thursday, November 7, 2013 8:12 PM