domhanak opened a new issue, #2127:
URL: https://github.com/apache/incubator-kie-tools/issues/2127

   File content:
   
   ```
   # Copyright 2024 Apache Software Foundation (ASF)
   #
   # Licensed under the Apache License, Version 2.0 (the "License");
   # you may not use this file except in compliance with the License.
   # You may obtain a copy of the License at
   #
   #     http://www.apache.org/licenses/LICENSE-2.0
   #
   # Unless required by applicable law or agreed to in writing, software
   # distributed under the License is distributed on an "AS IS" BASIS,
   # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   # See the License for the specific language governing permissions and
   # limitations under the License.
   
   apiVersion: sonataflow.org/v1alpha08
   kind: SonataFlow
   metadata:
     name: callbackstatetimeouts
     annotations:
       sonataflow.org/description: Callback State Timeouts Example k8s
       sonataflow.org/version: 0.0.1
   spec:
     persistence:
       postgresql:
         secretRef:
           name: postgres-secrets
           userKey: POSTGRES_USER
           passwordKey: POSTGRES_PASSWORD
         serviceRef:
           name: postgres
           port: 5432
           databaseName: sonataflow
           databaseSchema: callbackstatetimeouts
     podTemplate:
       container:
         env:
         - name: QUARKUS_FLYWAY_MIGRATE_AT_START
           value: "true"
       initContainers:
         - name: init-postgres
           image: registry.access.redhat.com/ubi9/ubi-minimal:latest
           imagePullPolicy: IfNotPresent
           command: [ 'sh', '-c', 'until (echo 1 > /dev/tcp/postgres.$(cat 
/var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local/5432)
 >/dev/null 2>&1; do echo "Waiting for postgres server"; sleep 3; done;' ]
     flow:
       start: PrintStartMessage
       events:
         - name: callbackEvent
           source: ''
           type: callback_event_type
       functions:
         - name: systemOut
           type: custom
           operation: sysout
       states:
         - name: PrintStartMessage
           type: operation
           actions:
             - name: printSystemOut
               functionRef:
                 refName: systemOut
                 arguments:
                   message: "${\"callback-state-timeouts: \" + 
$WORKFLOW.instanceId + \" has started.\"}"
           transition: CallbackState
         - name: CallbackState
           type: callback
           action:
             name: callbackAction
             functionRef:
               refName: systemOut
               arguments:
                 message: "${\"callback-state-timeouts: \" + 
$WORKFLOW.instanceId + \" has executed the callbackFunction.\"}"
           eventRef: callbackEvent
           transition: CheckEventArrival
           timeouts:
             eventTimeout: PT30S
         - name: CheckEventArrival
           type: switch
           dataConditions:
             - condition: "${ .eventData != null }"
               transition: EventArrived
           defaultCondition:
             transition: EventNotArrived
         - name: EventArrived
           type: inject
           data:
             exitMessage: "The callback event has arrived."
           transition: PrintExitMessage
         - name: EventNotArrived
           type: inject
           data:
             exitMessage: "The callback event has not arrived, and the timeout 
has overdue."
           transition: PrintExitMessage
         - name: PrintExitMessage
           type: operation
           actions:
             - name: printSystemOut
               functionRef:
                 refName: systemOut
                 arguments:
                   message: "${\"callback-state-timeouts: \" + 
$WORKFLOW.instanceId + \" has finalized. \" + .exitMessage + \" eventData: \" + 
.eventData}"
           end: true
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to