I am using recipient-list-router selector-expression, How do I match 2 strings there? first string is coming from payload which I can fetch using payload. but second string I want to compare first with is coming from enum defined in the project. Let's say I want to compare specific ActivityStatus enum value, say ActivityStatus.START.getStatus() with payload.getStatus()
<int:recipient selector-expression="@activityStatus.START.getStatus().equals(payload.getStatus())" channel="abc"/>
but it's giving me different errors if I try above code, also tried this but still not working,
<int:recipient selector-expression="#{@activityStatus).START.getStatus().equals(payload.getStatus())" channel="abc"/>
can you please help? I have also defined bean for ActivityStatus but no success.
I'm not sure how you made an enum
as a <bean>
, but the proper solution for your SpEL expression is based on a type operator:
T(ActivityStatus).START.status eq payload.status
The second sample in your question is fully wrong by syntax.
See more info in docs: https://docs.spring.io/spring-framework/reference/core/expressions/language-ref/types.html