Interface FlowAttachmentCommunication
- All Superinterfaces:
CommonDecorator, ExternalCommunicationDecorator, FlowCommon, FlowExternalCommunication
- All Known Subinterfaces:
FlowContext
- All Known Implementing Classes:
DefaultFlowContext
Flow-level attachment communication for reading and writing request-scoped attachment data.
- Since:
- 25.1
- Author:
- 渔民小镇
- date:
- 2025-10-09
-
Method Summary
Modifier and TypeMethodDescriptiondefault <T> TGet the typed attachment object.default <T> TgetAttachment(Class<T> clazz) Decode the request attachment bytes into the specified type.default voidEncode the current typed attachment and update it on the external server.default voidupdateAttachment(byte[] attachment) Update the request attachment on the external server with the given raw bytes, and synchronize the local request's attachment.default voidAsynchronously encode the current typed attachment and update it on the external server.default voidupdateAttachmentAsync(byte[] attachment) Asynchronously update the request attachment on the external server.Methods inherited from interface CommonDecorator
getCommunicationAggregationMethods inherited from interface ExternalCommunicationDecorator
bindingLogicServer, callExternal, callExternal, callExternal, callExternalAsync, callExternalAsync, callExternalAsync, callExternalAsync, callExternalCollect, callExternalCollect, callExternalCollect, callExternalCollectAsync, callExternalCollectAsync, callExternalCollectAsync, callExternalCollectAsync, callExternalCollectFuture, callExternalCollectFuture, callExternalCollectFuture, callExternalFuture, callExternalFuture, callExternalFuture, ofExternalRequestMessageMethods inherited from interface FlowCommon
execute, executeUser, executeVirtual, getBarSkeleton, getCmdInfo, getCommunicationType, getCurrentExecutor, getCurrentThreadExecutor, getExecutorRegion, getRequest, getServer, getServerId, getThreadIndex, getTraceId, getUserId, getUserThreadExecutor, getVirtualThreadExecutor, setMethodResult, setUserIdMethods inherited from interface FlowExternalCommunication
ofExternalRequestMessage
-
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
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
-