App startup event in back

Hi there.
I need to perform some actions in back when the app starts.
Is there a way to intercept the startup of an app in back?
I looked into predefined events but I couldn’t find any related.
Thanks in advance,
Paulo

Hello @Paulo_Mira

Could you explain what you mean when saying “app starts”? Are you about web app?

Yes, web app.
Thanks

You can create API service and make a call when app where started(On Before Page Enter event)

Hi Dima.
So, there’s no way to do it in back?
If I understand correctly, I would invoke the API service (let’s call it initApp) every time a user opens the webapp instead of just one time for the whole app.
I would then verify in the initApp service in back if has already been called, in order to prevent repetition.
Is this correct?
Thanks,
Paulo

What the difference between “whole app” and “webapp” in your case?

in order to prevent repetition.

You could prevent running the initApp twice on a client

Everything depends on purposes.

Sorry for the miscommunication - I’m not explaining myself clearly.
First, I assume that you’ve a webapp instance on server that handles multiple sessions of different users from multiple devices and, therefore, what I mean by “whole app” is the webapp on the server that I also assume that serves multiple clients and it is loaded just once.
Again, these are just assumptions from someone new to backendless that comes from the world of J2EE development.
Thanks again,
Paulo

I think that we confuse each other. Could we start again? Let me know what you want to achieve. Your business goal, skip tech details for now.

Ok, let’s reset.
Summarizing, I want to execute some actions (e.g. loading some values in memory) when the webapp starts in server.
Thanks Dima,
Paulo

What does mean “webapp starts in server”? You have your own server where you start some process? If so, how backendless is related to that?

Or you talks about starting bl-web-console with Backendless Pro CE?

No, I don’t have my own server - for now we’re using the backendless cloud.
Let me ask you something.
When a webapp is started on client it calls the server, for user login, etc. and possibly a InitApp service to do whatever is required.
Does the server keeps a session for the user to use on every call while the session is maintained in client (browser)?
If not, how is the cache being implemented on the server? Inside the DB?
Sorry for these questions, I’m just trying to undersand how does backendless back works in conjunction with the client in browser.
Thanks again,
Paulo

When a user logs in, a session token is generated and returned to the client. This token is stored on the client side. Each time the client makes a request to Backendless, it includes this session token to authenticate the user. This allows the server to recognize the user across calls without explicitly keeping a session state on the server itself.

Ok, clear now - no state at the server.
We require a series of “enums” in our webapp that may exist in more tha one object.
So far, I’ve only discovered the use of such types inside the DB w/ the Multiple choice type of column.
We’re thinking of creating a table of domain values (like enums in java) that we could load into memory.
Any ideas on how to achieve this?
It would be similar of what bubble has with “Option Sets” or, again, enums in java.
What about the backendless cache? Could it be used for such purpose?
Thanks again for your help and patience…
Paulo

@Paulo_Mira ,

Sorry for delay with the response.

CloudCode services are not running constantly on the server side. Required instance is started only when request to its method received from the client. Then, after execution, that instance is stopped.

Due to this you need to store that enum somewhere in persistent storage. I can suggest you to use Hive for this purpose since it provides fast access to the data. When your code needs that enum during runtime - it makes a call to the Hive and obtain it.

Regards, Andriy

Hi Andriy.
Thanks very much for your help - I’ll look into Hive.
Meanwhile, is backendless planning to implement the concept of enum in future ?
Thanks,
Paulo