NetTalk Central

Author Topic: create additional sessionqueues  (Read 4964 times)

alan

  • Jr. Member
  • **
  • Posts: 58
    • View Profile
    • Email
create additional sessionqueues
« on: September 04, 2013, 12:30:24 PM »
Bruce,

I'm working on an app with a large amount of data that is loaded into a queues and then processed.  This data needs to stay available throughout a session.  I would like to create those queues the same way SessionQueue is implemented.  That is, I want to instantiate them (and some classes) at the same time (with the same scope) as the SessionQueue and I want to delete (free) them when the session is deleted.

Do you have any embeds I could use at the point all this is happening with SessionQueue?  If no embeds, is there anything else you could recommend to accomplish this?

Thanks,

Alan
Alan Schoolcraft

bshields

  • Sr. Member
  • ****
  • Posts: 392
    • View Profile
    • Inhabit
    • Email
Re: create additional sessionqueues
« Reply #1 on: September 04, 2013, 04:08:04 PM »
Hi Alan,

I use the InMemory file driver with the SessionID as a key for this purpose.

Maybe that will help.

You could just define global queues (since threaded doesn't work, as sessions cross threads all the time) protected by critical sections, its cheaper! But you'll need to be careful, handy thing about the InMemory driver is if you want to do "stuff" with them, the normal clarion / nettalk templates work on them nicely.

Regards
Bill

Stu

  • Hero Member
  • *****
  • Posts: 510
    • View Profile
    • Email
Re: create additional sessionqueues
« Reply #2 on: September 04, 2013, 05:00:22 PM »
Hi Alan,

+1 what Bill said. Using IMDD files with Session_ID key is a great solution.
Cheers,

Stu Andrews

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: create additional sessionqueues
« Reply #3 on: September 04, 2013, 09:47:41 PM »
Hi Alan,

yes, In-Memory driver is perfect.
SessionID field needs to be a string(255).
And you can remove entries from this table when the session ends by adding code to
WebHandler
.NotifyDeleteSession method.

cheers
Bruce

Rob Kolanko

  • Sr. Member
  • ****
  • Posts: 253
    • View Profile
Re: create additional sessionqueues
« Reply #4 on: September 05, 2013, 11:24:06 AM »
I find this method of using memory tables easier to work with.  Instead of adding a session ID field in the memory table, I create a memory table with a "name" property containing the session ID. Effectively having a table just for that session. There is no collisions with same memory tables in different sessions because the tables names are different. When session is over or are finished with the memory table, Empty and Remove statements are used to clean-up the session's table.

Rob