Workflows (Early Access)

The Concierge Service Workflow example in Grainite demonstrates a service that books hotels for their customers and allows cancellation within 24 hours for a full refund. This sample application is only available in early access to design partners.

Customers booking the hotel provide the Concierge service with their email address, hotel information, and dates for the booking. The Concierge Workflow books the hotel and provides the booking ID to the customer. This bookingID can be used to cancel the booking within 24 hours.

The Java code and instructions to run the quickstart example along with a detailed readme are included in the Workflow/Quickstart example within the Samples directory of Grainite.

Architecture and flow of the Concierge application

  • Receive inputs (email address, Hotel information, and dates) from the customer.

  • Lookup hotel information. If the hotel does not exist, send an email to the user and terminate Workflow

  • If Hotel exists, and dates are available, book the hotel. Send the bookingID to the customer once confirmed and skip to bullet 5.

  • If unable to book the hotel, send an email to the customer and terminate the Workflow.

  • Wait for 24 hours (2 minutes in the example) to allow customers to cancel the booking using the bookingID. If cancellation is received, terminate the booking and send an email to the customer, and terminate the Workflow.

  • If the customer does not cancel the booking within 24 hours, send a final confirmation to the customer and terminate the Workflow.

The application configuration file is used to define the Workflow.

// Every workflow has exactly this yaml. Except for table_name, and WorkflowClass

app_name: Concierge
jars:
  - target/quickstart-jar-with-dependencies.jar

package_id: booking

tables:
  - table_name: BookingFlow
    table_type: workflow
    class_name: BookingFlow
    config:
      retryDelay: "PT30s"
      retryMaxDuration: "PT300s"
      cancellableDuration: "PT2m"
  - table_name: HotelInfo
    action_handlers:
    - type: java
      class_name: HotelHandler
      actions:
        - action_name: getInfo

Please refer to the Grainite Workflow Client and Context APIs for additional information for leveraging the Orchestration engine.

Last updated