The MSPro Boomi Collection
About
Good Practices & Patterns
Good Practices & Patterns
  • Markus' Boomi Integration
  • Implementation Patterns
    • The Cache Challenge
      • The Get-Or-Create Use-Case
      • PropCache Scripts
    • State Management
      • Example Scenario
      • State-Management in general
      • State-Management Functionality
      • Technical Solutions
        • Boomi File-System Implementation
          • saveState
          • readState & fetchStates
    • Exception Handling
      • Exception vs Error
      • Basic Rules
        • Aggregating Exceptions
      • Exception Handling Pattern
        • User-Defined Exception Messages
        • Catch Exceptions
      • The pattern in practice
        • API Error Handling
          • Single Record Strategy
            • Single Record RES
          • Many Records Strategy (Array)
            • Many Records RES
        • Pre-Condition Check
    • SQL Patterns
      • Script Header
      • General Rules
        • Check using RowCount
        • Check if record exists
        • Pagination and Sorting
        • Parameter - Best Practices
        • Use JSON as a complex parameter
    • Process Patterns
      • Process Route Implementation Pattern
      • Sub-Process or Process Route
    • DateTime
      • The Boomi datetime dilemma
      • Database and Flow
      • Groovy
      • Data Hub
      • Get Current Date
    • Groovy Script Patterns
      • Dynamic Document Properties
      • Dynamic Process Properties
      • Documents
    • Array Elements to Documents
  • MSPro Services
    • Intermediate Storage
      • Example Processes
        • Docs 01 - Update and Create
          • sub.SampleData.Invoice
        • 02 - Upsert and Get
    • Render Templates
  • Tips
Powered by GitBook
On this page
  1. Implementation Patterns
  2. State Management

State-Management Functionality

The functionality required for state management naturally depends on the project's requirements for state management. In the simplest case, the import process receives the data and saves its status. A second asynchronous process then sends the IMPORTED data to the target system and sets its status to SUCCESS or FAILED (separated import and update processes).

The first function we need, of course, is saveState( payload, newState).

Save state will actually be split into updateState( id, state) and createState( playload, initialState). The payload represents the received data from the customer and it should be immutable once the state has been created. Create state returns the id that is used in later context to update an existing state.

The second function that is needed is fetchStates( state) to fetch all records with a certain state.

Get, Query and Fetch

Get returns a single record (by id). It is expected that this record exists. Otherwise, an exception is thrown.

Query returns 0..n record ids using any number of query parameters. After querying records you can get each record's data.

Fetch is a combination of query and get and it allows you the query records to return the full records (incl. payload).

Example: Files in a directory: the filename is the id which you can use to get (read) a file's content. You can query filenames to list files matching a filter, or you can fetch files to read the content of all files of a filtered file list.

Your requirements on state-management will probably be more complex than these two basic function.

Last updated 6 months ago