Claus Ibsen created CAMEL-27611:
-----------------------------------

             Summary: camel-bonita: login per request, processName search, 
missing required flags, fixed path
                 Key: CAMEL-27611
                 URL: https://issues.apache.org/jira/browse/CAMEL-27611
             Project: Camel
          Issue Type: Bug
          Components: camel-bonita
            Reporter: Claus Ibsen
             Fix For: 4.24.0


Found while improving the option descriptions of camel-bonita for CAMEL-23832 
(PR https://github.com/apache/camel/pull/30947).
These are separate problems of the component; the descriptions PR only 
documents the current behavior.

h4. 1. The producer logs in again before every REST request
{{BonitaAuthFilter.filter()}} logs in at {{loginservice}} whenever the request 
has no {{JSESSIONID}} cookie. The JAX-RS client of {{BonitaStartProducer}} 
keeps no cookies, and the filter puts the session cookies only on the current 
request. So every request logs in again: the process search, each file upload 
and the instantiation. One {{startCase}} exchange with one file input sends 
three logins, and every login opens a new Bonita session.
Proposed change: keep the session cookies and the {{X-Bonita-API-Token}} after 
the first login, reuse them, and log in again only when Bonita answers 401.

h4. 2. processName is a search term, and the first result is used
{{BonitaAPI.getProcessDefinition()}} sends {{processName}} as the search 
parameter {{s}} of {{GET /API/bpm/process}} and takes {{listProcess.get(0)}}. 
When the name matches more than one process, or a process is deployed in more 
than one version, the producer can start a case of another process or version 
than the intended one, with no error or warning. No option selects the version.
Proposed change: filter on the exact name ({{f=name=...}}) and add an optional 
{{processVersion}} option, or pick the latest enabled version when it is not 
set.

h4. 3. processName, username and password are not marked required
The producer cannot work without them, but the metadata does not mark them 
{{required}}. {{BonitaAPI.getProcessDefinition()}} throws 
{{IllegalArgumentException("processName is empty.")}}, and 
{{BonitaAuthFilter.filter()}} throws for an empty username or password. The 
error comes only with the first exchange, not when the route starts.
Proposed change: mark the three options {{@Metadata(required = true)}}, or 
check them when the producer starts.

h4. 4. The context path /bonita cannot be configured
{{BonitaAPIConfig.getBaseBonitaURI()}} builds {{hostname:port/bonita}}. A 
Bonita server deployed under another context path, or behind a reverse proxy 
with another path, cannot be reached.
Proposed change: add an option for the base path, with {{/bonita}} as default.

h4. 5. BonitaConfiguration.setParameters(Map) is not used
{{BonitaConfiguration.setParameters(Map)}} is not called anywhere; the options 
are set through the generated configurer. It also handles only three of the 
options.
Proposed change: remove it (deprecate first, as {{BonitaConfiguration}} is 
public).

_Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to