luigidemasi commented on PR #26684:
URL: https://github.com/apache/camel/pull/26684#issuecomment-5761729109
> @davsclaus @luigidemasi I am not sure regarding using it as a language or
not, for sure it is not a language, on the other hand, it would be nice to
somehow use jev expressions in filter/choice and so on. As far as I understand,
you can pass unstructured text to jev, and some rules, and it will reply only
with either a boolean, or a confidence score
@Croway, @davsclaus, you can achieve it using predicates, something like:
```yaml
- beans:
- name: messageBody
type: org.apache.camel.Expression
factoryBean: org.apache.camel.support.builder.ExpressionBuilder
factoryMethod: bodyExpression
- name: refundPredicate
type: org.apache.camel.component.jev.JevPredicate
constructors:
0: jev:refund
1: "#bean:messageBody"
2: Does this message request a refund?
3: "0.8"
- from:
uri: direct:filter
steps:
- filter:
ref: refundPredicate
steps:
- to: direct:refund-handler
- from:
uri: direct:route
steps:
- choice:
when:
- ref: refundPredicate
steps:
- to: direct:refund-handler
otherwise:
steps:
- to: direct:general-handler
```
It's not a standard (yet), and SemIf (former openjev) exposes different
interfaces,
[razorback16/openjev](https://github.com/razorback16/openjev) and
[ekzhang/openjev-sglang](https://github.com/ekzhang/openjev-sglang) explicitly
implement the TypeSafe API.
They are candidates for use through the component’s configurable baseUrl,
but I haven’t tested them with Camel.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]