Class EventUtil

java.lang.Object
com.ssgllc.fish.service.util.published.EventUtil

@Component public final class EventUtil extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
    EventUtil(org.springframework.context.ApplicationEventPublisher eventPublisher, com.ssgllc.fish.service.listener.CasetivityExecuteScriptEventListener casetivityExecuteScriptEventListener)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    Publishes a CasetivityExecuteScriptEvent to trigger execution of a Groovy script asynchronously in a new transaction, after the current transaction successfully commits (or immediately if no transaction is in progress.
    This is useful when you want to run dynamic, post-commit logic decoupled from the main transaction flow—such as sending notifications, updating external systems, or performing complex business rules—without blocking or affecting the main transaction.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • EventUtil

      public EventUtil(org.springframework.context.ApplicationEventPublisher eventPublisher, com.ssgllc.fish.service.listener.CasetivityExecuteScriptEventListener casetivityExecuteScriptEventListener)
  • Method Details

    • publishScriptEventAfterTransaction

      public static void publishScriptEventAfterTransaction(String scriptName, Map<String,Object> data)
      Publishes a CasetivityExecuteScriptEvent to trigger execution of a Groovy script asynchronously in a new transaction, after the current transaction successfully commits (or immediately if no transaction is in progress.
      This is useful when you want to run dynamic, post-commit logic decoupled from the main transaction flow—such as sending notifications, updating external systems, or performing complex business rules—without blocking or affecting the main transaction.
      The script referenced by scriptName will be resolved and executed with the provided data map made available to the script under the variable name data.

      Groovy example:
      eventUtil.publishScriptEventAfterTransaction('DeductProductQuantity', [ productId: '123' ])

      Effect:
      After the transaction commits, the script DeductProductQuantity script will be executed asynchronously with access to:
      data.productId == 1234
      Note: Script execution happens in a separate transaction and thread, and will not impact the outcome of the original transaction.