Claus Ibsen created CAMEL-27834:
-----------------------------------
Summary: camel-pgevent: an upper-case channel never delivers, a
slash in a query value breaks the URI parsing
Key: CAMEL-27834
URL: https://issues.apache.org/jira/browse/CAMEL-27834
Project: Camel
Issue Type: Bug
Components: camel-pgevent
Reporter: Claus Ibsen
Fix For: 4.25.0
Found while improving the option descriptions of camel-pgevent for CAMEL-23832
(pull request https://github.com/apache/camel/pull/31142).
These are separate problems of the component; the descriptions change only
documents the current behavior.
h4. 1. A channel with upper-case letters never delivers
{{PgEventConsumer.initConnection}} sends an unquoted LISTEN MyChan, which
PostgreSQL folds to mychan, then registers the driver filter
Pattern.compile("MyChan"); pgjdbc-ng 0.8.9 matches it case-sensitively against
the reported name (mychan), so it never matches. {{PgEventProducer.process}}
calls pg_notify('MyChan', ...), which keeps the case, so no listener receives
it.
Proposed change: lower-case the channel (or quote it in LISTEN/UNLISTEN and use
Pattern.quote in the filter), and send the same name from the producer.
h4. 2. A slash in a query value breaks the URI parsing
{{PgEventEndpoint.parseUri}} runs its regular expressions on the whole URI,
query included: pgevent://myhost:6543/mydb/chan?user=u&pass=a/b gives database
"mydb/chan?pass=a" and channel "b" (checked with a test).
Proposed change: strip the query (use the remaining part) before matching.
h4. 3. The short form pgevent:db/channel never parses
Camel hands over the normalized pgevent:// form, so FORMAT4 never matches
correctly: pgevent:mydb/mychannel gives database "/" and channel "mydb"
(checked with a test).
Proposed change: remove FORMAT4, or make it match pgevent://db/channel.
h4. 4. Dead branch for servers older than 9.0
{{PgEventProducer}} has a branch for servers before 9.0 that runs SELECT
pg_notify, which only exists from 9.0.
Proposed change: remove the branch.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)