Uniface on GitHub
Product (releases and patches)
Fixes and Updates
If I have a component that is a form, with code in the Async Interrupt trigger I understand how the code responds to the postmessage instruction. However, if the form is converted to a service, how does the code in the Async Interrupt trigger ever execute? Or is the short answer, it never does - because a service only responds to activate instructions that invoke specific operations and once the operation has completed, the service terminates, and there is no opportunity for it to wait and listen for interrupts.
Trying to get a better feel for how services do and do not work.
your description is correct when using a single activate instruction to execute your service, like this:
In this case Uniface runtime based on the code is doing for you:- instanting your service- executing your operation- deleting the service instance
To be able to exchange messages with a service your code should explicitely instanciate your service giving it a lifetime in memory, like this:
newinstance "MYSERVICE", "MYSERVICE"activate "MYSERVICE".myOperation(myParams)deleteinstance "MYSERVICE"
If you instanciate your service while starting your application you could postmessage it for the whole application lifetime.
I hope it helps.
Oh? I understood that an activate was enough to keep the service resident (unless the operation ends with an exit) which is why we start all our services activate/stateless.
Our original problem was that the activate caused the client to wait for the original userver process to run the service for a second time, and since we use shared uservers, it was having to queue behind another entirely unreleated process. the /stateless rendered the service call single use, and allowed the second call to be routed to a different userver.
My answer to Harjit was just the most basic one; then I've read your post and...it's my time to tell: Oh?
Let me try to understand what you are talking about...your basic Uniface configuration using userver is a web one or a C/S with some partitioning?
C/S. Clients on PCs (different machines), shared urouter/uservers on server machine.
The activate on the PC starts the service on a particular userver UST. Until we used activate/stateless, if the particular client needed to activate the same service, it would try and find the same userver PID it used before. If someone else was currently connected to that userver, it would wait for that process to finish before running the service. Since many clients can access the same userver, we would wind up with simple data lookups queuing behind 'long' running updates, and is slowed the system down.
Now we use activate/stateless, the client starts a new copy of the service on any available userver.
I believe that the service was an active, stateful instance on the original userver unless it found an exit statement.
Iain, thanks for your description.
I am not yet sure to have fully understood your scenario; my gotfeel is with activate/stateless you are forcing your services execution to be stateless within your set of uservers.How this is achieved from urouter/uservers is not technically totally clear to me; probably urouter, acting as a load balancer, gives privilege to queue the request to a new userver (up to /max) instead of queueing it to an existing userver.
I would like to have time to bring this discussion further to fully understand how activate/stateless is technically working.
I feel your configuration hasn't any to do with the initial Harjit question.
My recollection is that we switched to activate/stateless because a straight activate, without a newinstance, created a long running instance, which would exist for the live of the userver process. So my understanding of what does and doesn't create a service instance you can postmessage differs from yours. I don't think there's an implicit deleteinstance in the activation proc.
I made a quick test. It's confirming there is NOT an implicit deleteinstance in a simple activate proc.
Thanks for helping to clarify it.
In our application we have several stand-alone (detached) Uniface services running on an application server. We can communicate with these services using postmessage from the client to the service and vice versa.
To create the service I agree with Gianni, but in my opinion the service instance should never be deleted, if the service instance is deleted it can't be addressed anymore because it's gone.
With kind regards,
Yes, you're right...my description was not clear enough!
© 2019 Uniface Privacy & Cookies | Privacy Statement | Legal