Lifecycle Delphi datasnap which to use?

Asked

Viewed 2,792 times

1

Greetings to all.

I developed an app for android using datasnap Reflection REST technology with JSON Delphi using firedac data connection engine on the server.
This app basically has the data query function.

My question is what kind of Lifecycle would be ideal to use.

3 answers

1


The estate LifeCycle has basically three options:

  • Server: The server maintains a single instance of the class on the server, all clients upon requesting that class will always receive the same instance (Singleton).
  • Session: The server maintains an instance of the Datasnap class per session, each client receives a different instance of the class.
  • Invocation: At each invocation of a client a class instance will be created and then destroyed (Stateless).

The documentation states that for customers REST, if the chosen life cycle is Session in Dsserverclass, Session shall behave as if Invocation. If you have no major problems, the first option, Server, might be appropriate.

  • I’m using Session and it’s behaving like Session, so much so that after a time of inactivity it loses the session and I have to reconnect. Actually I wanted to know what loss I have in using input in my case.

  • @edmjunio Basically when using Invocation you create a new instance for each customer invocation.

  • Okay this I have science but it would have some burden this modality? By what I’ve been reading the REST technology is by default statless ie Invocation. I use authentication in the access process because using Input I will have to redo authentication to each server request ?

  • @edmjunio I believe in theory yes.

  • I’ll test and report

0

I modified the lifecycle on the server to Invocation. On the client, I modified the property PreserveSessionID of the component Drestconection for false because I don’t have the need to manage or create sessions. This way in case of unavailability of the server or of link internet once the interruption is resolved the app will be able to redo the connection.

The security routine I use, is applied in two moments, at the time of the creation of the mainform where menus are mounted and during component connection Drestconection where the login and password are passed to access the server methods.

At first it worked I’m doing more tests to reach a final conclusion.
Thank you all for your help.

  • If this worked for you, mark your answer as accepted. See more details here.

0

If you are using REST and without session q is Session of course it is not necessary to change it. By the same protocol feature. Connects processes and disconnects.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.