To define a queue service:
1. | Choose Service, New Queue Service from the menu. |
2. | Set the following values: |
| Queue Service Name = (the name of the queue service) |
| Application Name = (the name of the USoft application where the queue table is defined) |
| Queue Table Name = (the name of the queue table as defined in Definer) |
| Selection Connection Name = (the name of the Service Definer connection that will be used to execute the selection on the queue table). The default implementation of a queue service uses following select statement: |
SELECT RECORDS(1, 50) id
FROM queue-table
WHERE status = 'NONE'
AND
(
:msgid is null
OR id > :msgid
)
ORDER BY id ASC
|
:msgid is the message id of the last selected row.
Processing Connection Name = (the name of the Service Definer connection that will be used to execute processing statement, that is Process Statement Name).
| Process Statement Name = (the name of the statement used for processing a row in the queue table). |
Following are created by Service Definer:
1. | Service (Other), with the name specified by Queue Service Name field, with following default implementation: |
Functional Type = "USoft Engine Task Provider"
Annotations = @QueueTask(name="(queue-table-name)", selectConnection="(selection-connection-name)", processConnection="(processing-connection-name)")
Methods: onMessage
•Default implementation of the method executes the process statement SQL using messageId as input parameter.The messageId parameter holds the value of the next queue table ID that has to be processed. •onMessage is a callback method, called by the service framework when a row from the queue table must be processed. The logic when a row from the queue table is offer for processing resides in the selection, and default implementation is: a row from the queue table is given for processing if its status is NONE and its message id is higher than the last selected one. •Parameters: (one input string parameter). | If the signature changes the method will not be called by the service framework anymore. At runtime an error is added to the log file that the service cannot start because the onMessage method is not correct. |
2. | An application is added with the name specified by Application Name field, if it does not exists. |
3. | A connection is added with the name specified by Selection Connection Name field, if it does not exists. |
| The connection has a rule service with following properties: |
| Change the properties of the rule service to the desired ones. |
4. | A connection is added for the value specified by Processing Connection Name field, if it does not exists. |
| The connection has a rule service with following properties: |
| Change the properties of the rule service to the desired ones. |
| You can also used the same connection name for Selection Connection Name and Process Connection Name. For administration reasons it might be easier to use different names, that may in fact use the Rules Service. |
5. | A statement is added with the name specified by Process Statement Name field if it does not exists, having following SQL Statement |
INVOKE BatchRunner.PROCESS_QUEUE WITH SELECT :msgid "ID", 'True' "-quiet"
| Change the default SQL Statement, or just the job name in the SQL Statement with the job in Definer that does the processing. |
6. | Twoo properties are added to the global properties: |
•<queue service name>#USoftUser = USoft user name used to connect to the rule service defined in selection and processing connections •<queue service name>#USoftPassword = USoft password used to connect to the rule service defined in selection and processing connections |