Are web services processed sequentially or in para

2019-08-30 05:44发布

问题:

I am just getting started in web services using Lotus Notes. What I would like to be able to do is to create a web service that generates a sequential number. The code to generate the number is based on existing code we have used for some time within our databases (just straight lotus script, no web services). Basically there is a document that stores the next number, the next number is returned and is updated for the next call save conflicts are detected and the number is tried again if there was a issue saving the number.

I thought I might use a web service for to generate the number. So are web services processed sequentially or in parallel? Because if they are serial then I won't need to deal with two people trying to save the number at the same time.

回答1:

Web services are a way for two systems to communicate with each other where they would not have a common language.

For example LotusScript agent connecting to a .Net server.

When creating a web service provider (server) on Domino you can code it in LotusScript or Java. The server then provides a WSDL file for the consumer (client) to write the code required to talk to that web service.

This tutorial should explain it better for you:

http://www-10.lotus.com/ldd/ddwiki.nsf/dx/Creating_your_first_Web_Service_provider_and_consumer_in_LotusScript_and_Java.

Now as for Domino. Web services run in order they are requested from the server. However there is no control to say "Don't start until Webservice X has finished".

You could also code this into an application but run the serious risk of deadlocks of memory/performance issues for other users unless you counter for that.

The Domino server can also be set to not run web services/agents in parallel. But again you risk the same issues.

If it is a unique ID then you could go by the UNID of the document you create from the web service. Or you can use @UNIQUE via an evaluate, but both only return text.

http://publib.boulder.ibm.com/infocenter/domhelp/v8r0/topic/com.ibm.designer.domino.main.doc/H_UNIQUE.html



回答2:

From the Lotus Designer Documentation:

To enable concurrent Web services on a server, you must enable concurrent Web Agents on that server. Open the Server document you want to edit. Click the Internet Protocols - Domino Web Engine tab. Enable Run Web Agents concurrently.

The maximum number of concurrent Web service calls is determind by "Max concurrent agents"-setting. From the Lotus Administration Documentation:

Max concurrent agents Specifies the number of agents allowed to run concurrently. Valid values are 1 through 10. Default values are 1 for daytime and 2 for nighttime. Enabling a higher number of concurrent agents can relieve a heavily loaded Agent Manager, but also reduces the resources available to run other server tasks.

Lotus Notes Domino Version 8.5.x



回答3:

Yes web services Will run in parrallel. But since you wrote that your code deals with save conflict, you should NOT have problem.
As in standard notes calls by 2 users: the 1st get the doc then the 2nd get the doc and save (speedy two) then first will get save conflict. In conclusion yes it's parallel BUT it's not a problem.



回答4:

I would have thought that they would by default run sequentially as asynchronous web agents is off unless you switch it on. So although it's a good design pattern to do 'safe' sequentially number if you only allocate a number via the web service and you haven't changed the asynchronous setting then you'll be fine



回答5:

Let me also add:

Employ document locking to assure number uniqueness in sequential document numbering solution



回答6:

There is a simple solution that avoids synchronicity considerations.

You should generate a temporary number using @Unique, then use a scheduled agent to assign sequential numbers in order of document creation, selecting only unprocessed documents using a properly constituted view. If you're not concerned about the order in which documents were created and only concerned that all numbers are unique, a view is not necessary, and you can just trigger the agent on unprocessed documents.

The temporary number can be used for reference temporarily until a proper sequential number is assigned.

When the scheduled agent runs, it should send authors confirmation with the correct reference number.



回答7:

Or, you could export to DXL and get the sequence= attribute of the tag. This only works if you're accessing a single instance of the database, though. And the DXL export/XML import is a huge amount of overhead.

Unfortunately, I can't see a way to easily get the sequence number of the note from LotusScript NotesDocument. If you have an active support contract, you could open a Problem Management Report for a software enhancement request ("APAR", in IBM's parlance, though I do not know what its acronym expands to).

Good luck!