Is it possible running DAServer under windows service with tray icon? If without tray icon, then I can’t reload the new schema in DAServer or pause DAServer service for special situation.
I can recommend to create a special app (aka admin tool) that will communicate with your service and perform some special actions like reload schema, etc
for example, we have
Relativity Server and have
Relativity Server - Admin tool
How to create a special app? What is the meaning of “aka”?
Any example for create “Admin Tool”?
it can be usual client app that performs administrative actions. it can be connected to special service. Since it is usual GUI app, it can have tray icon.
you can protect access to this service with Roles and/or with Service Group feature (Delphi only) .
Also this service can be accessed via special port and can use another server type.
for example, if your server app uses HTTP server, administrative service can be accessed via TCP/SuperTCP, etc
Thanks for your explanation. If use “Admin Tool” to load the schema, that means I should load the schema file in DAServer instead of embedded in TDASchema. Right?
it depends on your implementation.
if you don’t change schema inside _Impl, you can move schema to server datamodule so it will be shared for all data service instances. in this case you can just update schema in shared data module.
by other hand, you can put schema near to .exe and load it from file at creating data service.
In my case, my application still has many modules that need to build up. So I must always create tables, stored procedures. Totally should over 300 tables and stored procedures. If load from schema file, it needs much time to ready the DAserver schema service? I don’t disturb the users within office hours who are using in different countries with different time zone. Any advise?
You can use this way:
- have schema(s) in server datamodule
- at creating data service (
_Impl), it should assign server data module’s schema from to own schema
- when schema should be updated, you update server data module’s schema
in this case you can update schema anytime:
- already connected users will use old version of schema so they can finish their requests w/o any issues
- newly connected users will use new version of schema
This is a good solution that meet my expectation. But I don’t know how to implement the following two points.
procedure TDataService.DataAbstractServiceCreate(Sender: TObject); begin //Self.ServiceSchema = Schema Schema.Assign(ServerDatamodule.Schema); end;
you can do it in your admin service like
Many thanks. I will try to study how to build admin tool and apply your suggestion.
Could you provide the demo application for me? Because I found DAServer is not stable when using system tray icon. It will close application automatically when running some periods.
Note: you should add TTrayIcon component and related code manually. You can use code from the TTrayIcon (Delphi) - RAD Studio Code Examples article
I’m using PNotifyIconData to handle trayicon instead of using TTrayIcon component.
TTrayIcon uses internally PNotifyIconData so you should have equal result.
I think, better to use standard Delphi component instead of calling pure WinAPI methods - it may give more stable results because this component was tested by many Delphi users.
Noted with thanks.
I want to apply this solution in my DAServer. Any demo for my reference? Because my application is go live and it has many enhancements. I don’t want all users quit the applications when I deploy the new scheme.
You shouldn’t have any issues with putting Data Abstract Server to tray.
Data Abstract Server is usual Delphi application so “tray icon” functionality should work as with any other Delphi application.
you can apply solution from the TTrayIcon (Delphi) - RAD Studio Code Examples article.
My second question is not TTrayIcon issue. My second question is how to achieve the following result.
I don’t think, that you need a testcase for this:
ofc, you can protect above calls with
TMultiReadExclusiveWriteSynchronizer for make them thread-safe.