Interface FlowAttachmentCommunication

All Superinterfaces:
CommonDecorator, ExternalCommunicationDecorator, FlowCommon, FlowExternalCommunication
All Known Subinterfaces:
FlowContext
All Known Implementing Classes:
DefaultFlowContext

public interface FlowAttachmentCommunication extends FlowExternalCommunication
Flow-level attachment communication for reading and writing request-scoped attachment data.
Since:
25.1
Author:
渔民小镇
date:
2025-10-09
  • Method Details

    • updateAttachment

      default void updateAttachment(byte[] attachment)
      Update the request attachment on the external server with the given raw bytes, and synchronize the local request's attachment.
      Parameters:
      attachment - the encoded attachment bytes
    • updateAttachmentAsync

      default void updateAttachmentAsync(byte[] attachment)
      Asynchronously update the request attachment on the external server.
      Parameters:
      attachment - the encoded attachment bytes
      See Also:
    • updateAttachment

      default void updateAttachment()
      Encode the current typed attachment and update it on the external server.
      See Also:
    • updateAttachmentAsync

      default void updateAttachmentAsync()
      Asynchronously encode the current typed attachment and update it on the external server.
      See Also:
    • getAttachment

      default <T> T getAttachment(Class<T> clazz)
      Decode the request attachment bytes into the specified type.
      Type Parameters:
      T - the attachment type
      Parameters:
      clazz - the target class to decode into
      Returns:
      the decoded attachment object
    • getAttachment

      default <T> T getAttachment()
      Get the typed attachment object. Must be implemented by subclasses.

      examples

          public class MyFlowContext extends FlowContext {
              MyAttachment attachment;
      
              @Override
              public MyAttachment getAttachment() {
                  if (Objects.isNull(attachment)) {
                      this.attachment = this.getAttachment(MyAttachment.class);
                  }
      
                  return this.attachment;
              }
          }
      
          public class MyAttachment {
              long userId;
              ...
          }
      
      
      Type Parameters:
      T - the attachment type
      Returns:
      the attachment object