prosgarz35 opened a new pull request, #3194:
URL: https://github.com/apache/james-project/pull/3194
## Description
Migrate the embedded message broker from **Apache ActiveMQ (Classic 6.x)**
to **Apache ActiveMQ Artemis (2.56.0)** using Jakarta JMS 3.x APIs.
## Motivation & Rationale
- ActiveMQ Classic relies on legacy components (`BrokerService`, `KahaDB`,
proprietary out-of-band `BlobMessage` / `FileSystemBlobTransferPolicy`).
- Modernize the messaging subsystem with an embedded **Apache ActiveMQ
Artemis** broker:
- High-performance InVM transport (`vm://0`).
- Native Artemis journal persistence.
- Elimination of non-portable proprietary blob APIs in favor of standard
Jakarta JMS operations.
---
## Summary of Changes
### 1. Dependencies & Modules
- **`pom.xml`**: Added `org.apache.artemis:artemis-jakarta-server` to
`<dependencyManagement>` (excluding Netty).
- **`server/queue/queue-activemq`**: Replaced `activemq-broker` and
`activemq-kahadb-store` with `artemis-jakarta-server`.
- **`server/queue/queue-jms`** & **`server/container/spring`**: Updated
dependencies to use Artemis server coordinates.
### 2. Embedded Broker Implementation
- **`EmbeddedActiveMQ.java`**:
- Migrated from Classic `BrokerService` to
`org.apache.activemq.artemis.core.server.embedded.EmbeddedActiveMQ`.
- Configured embedded InVM acceptor (`InVMAcceptorFactory`) with security
disabled.
- Enabled native Artemis journal storage under `var/store/artemis`.
- Configured client connection factory with `vm://0?broker-name=james`,
`consumerWindowSize=0`, and `blockOnAcknowledge=true`.
### 3. Mail Queue & JMS Specification Compliance
- **Removed Obsolete Blob Logic**:
- Deleted `FileSystemBlobStrategy.java`,
`FileSystemBlobTransferPolicy.java`, and `MimeMessageBlobMessageSource.java`.
- Cleaned up blob message handling in `ActiveMQCacheableMailQueue`,
`ActiveMQMailQueueItem`, and `ActiveMQMailQueueFactory`.
- **Property Identifier Escaping (`JMSCacheableMailQueue.java`)**:
- *Fixes `AMQ139012`*: Artemis strictly enforces the JMS identifier spec
(`Character.isJavaIdentifierPart`), rejecting attribute names with dots/hyphens.
- Added hex encoding/decoding (`_XXXX_`) with prefixes `JAMES_ATTR_` and
`JAMES_MAIL_PER_RECIPIENT_HEADERS_` while retaining backward compatibility for
unescaped legacy properties.
### 4. DI & Metrics
- **Guice & Spring**: Removed `KahaDBPersistenceAdapter` bindings and
updated bean definitions.
- **Metrics**: Replaced `StatisticsBrokerPlugin` dependency with a no-op
collector; Artemis natively exposes metrics via JMX and Management API.
### 5. Test Infrastructure
- **`BrokerExtension.java`**: Updated JUnit 5 extension to launch isolated
embedded Artemis instances using unique `server-id`s.
- Updated unit and integration tests across `queue-activemq` and `queue-jms`.
---
## Testing & Verification
- **Build & Checkstyle**:
- `mvn clean install -DskipTests` passed with 0 Checkstyle violations.
- **E2E & Load Testing (`james-server-postgres-app`)**:
- Health checks verified: `Postgres: healthy`, `Embedded ActiveMQ:
healthy`.
- **Single connection benchmark:** 500 messages, 100% success rate (~49.1
msgs/sec).
- **Concurrent load benchmark (8 threads):** 5,000 messages, 0 failures,
avg latency 167.5 ms, throughput 47.64 msgs/sec.
- Verified persistence and delivery in PostgreSQL mail tables.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]