Class MessageUtils
java.lang.Object
com.broadleafcommerce.common.messaging.MessageUtils
Utility methods useful for creating and working with messages, such as compression and
decompression of large payloads.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic String
compressAndEncode
(List<String> stringList) static org.apache.camel.cluster.CamelClusterEventListener.Leadership
createLeadershipListener
(Consumer<Boolean> leaderConsumer) Create a listener with a different shape depending on the detected Spring Boot version.decodeAndUncompress
(String stringListPayload) static boolean
Determines whether theCamelClusterMember
representation is the current cluster leader.
-
Field Details
-
leadershipConstructor
-
-
Method Details
-
decodeAndUncompress
-
compressAndEncode
-
isLeader
Determines whether theCamelClusterMember
representation is the current cluster leader. This method is capable of accepting eitherOptional<CamelClusterMember>
instance, or aCamelClusterMember
instance. The former is expected when the Spring Boot version is less than or equal to 3.2. The latter is expected when the Spring Boot version is greater than 3.2.- Parameters:
leader
- TheCamelClusterMember
representation to inspect- Returns:
- Whether the member is the leader
- See Also:
-
createLeadershipListener
public static org.apache.camel.cluster.CamelClusterEventListener.Leadership createLeadershipListener(Consumer<Boolean> leaderConsumer) Create a listener with a different shape depending on the detected Spring Boot version. Spring Boot versions less than or equal to 3.2 will haveCamelClusterEventListener.Leadership
shape defined in camel 4.5.0. Spring Boot greater than 3.2 will get the shape defined in camel 4.7.0. This complexity is hidden from the implementation. Instead, all that is required is aConsumer
that accepts a boolean indicating if the current instance is the leader. The consumer can then perform whatever work is necessary in reaction to the leadership change.- Parameters:
leaderConsumer
- Consumer that receives a boolean denoting if this instance is currently the leader.- Returns:
- The instantiated leadership changed listener
-