9 Replies Latest reply on Jun 7, 2007 12:53 AM by ricardoarguello

    How can I track connections by user?

    teknokrat

      I am in the process of writing a JCS connector for a system. Each user is to have their own connection to the system for the duration of their session. The access is non-transactional.

      How might I go about doing this with jboss? Should I use a byApplication pooling strategy ( with min/max size set to 1)?

      cheers

        • 1. Re: How can I track connections by user?
          teknokrat

          Damn, thats JCA connector. ;)

          • 2. Re: How can I track connections by user?
            vickyk

             

            Each user is to have their own connection to the system for the duration of their session.

            How do you define the "duration of the session" ?
            What EIS would be connecting through the outbound JCA ?

            • 3. Re: How can I track connections by user?
              teknokrat

              The duration of the session is however long the user remains logged into the system. This could be hours but practically we will have a timeout of some length.

              The EIS is a bespoke system using a bespoke protocol. I need to create a socket and keep it connected to the EIS for as long as the user is using the system. The protocol is bidirectional, asynchronous, ascii streams.

              Under normal circumstances i would use a Stateful session bean to cache the connection, but I am stuck with some legacy architecture that forces me to treat the user's interactions in a request/response fashion.

              Therefore, I am after a solution where each time a user makes a request, the same connection from the pool is always used.

              cheers

              • 4. Re: How can I track connections by user?
                vickyk

                 

                Therefore, I am after a solution where each time a user makes a request, the same connection from the pool is always used.

                Yes looks like byApplication pooling strategy would work in this case . But you need to understand that byApplication pooling strategy comes with connection pool per user , I think you are aware of that as you would be keeping a single MC in a pool .
                All I see what you need to do would be
                1) Create a MCF , MC , CF etc stuff
                2) Prepare a RAR
                3) Have a -ds.xml file defining the connection factory stuff , this would be used by ConnectionFactory deployer to bind the CF in the JNDI.

                BTW have you started the development or you are about to begin ?


                • 5. Re: How can I track connections by user?
                  teknokrat

                  Ok, thanks, that sounds good. I have started on the development, but only recently.

                  Also, what is the correct mechanism for returning connections back to the pool? I get them via the connection managers allocate method but I can't figure out how i tell the pool that I am returning the connection.

                  cheers

                  • 6. Re: How can I track connections by user?
                    vickyk

                     

                    I get them via the connection managers allocate method but I can't figure out how i tell the pool that I am returning the connection.

                    You need to call the close method on the Connection which should eventually call the method on the ManagedConnection which in turn should call the ConnectionEvenListerner to close the connection . This goes as per the specs , would it be possible for you share the code I can have a look at how you are doing this ?
                    I don't have knowledge about the bespoke protocol but that should not create any hindrance in understand the skeleton JCA implementation which you would be doing .



                    • 7. Re: How can I track connections by user?
                      teknokrat

                      I can zip up the classes for you. where would you like me to send them?

                      • 8. Re: How can I track connections by user?
                        vickyk

                        You can send it at vicky.kak@gmail.com .

                        • 9. Re: How can I track connections by user?
                          ricardoarguello

                          There is no relation between the time a managed connection lives and the time a user keeps logged in. I would be interested in helping you develop a way to close a ByApplication or BySubject connection once the users logs off. Please drop me a line: ricardo.arguello gmail.com