diff --git a/TODO.md b/TODO.md index afab29f651b0..e703edc8dd35 100644 --- a/TODO.md +++ b/TODO.md @@ -806,16 +806,15 @@ These are bugs, correctness issues, or missing functionality that may affect pro ## Documentation TODOs -### 75. Tribes Documentation (5 files) +### 75. Tribes Documentation (3 files) | # | File:Line | Description | Fix Idea | Effort | Difficulty | |---|-----------|-------------|----------|--------|------------| | 75.3 | `docs/tribes/setup.xml:33` | Empty TODO placeholder | Write cluster setup guide: single-point vs multi-point, load balancer config, session replication. | 3-5 days | Medium | -| 75.5 | `docs/tribes/interceptors.xml:33` | Empty TODO placeholder | Document all cluster interceptors: fault tolerance, flow control, message dispatch, etc. | 2-3 days | Medium | | 75.6 | `docs/tribes/faq.xml:33` | Empty TODO placeholder | Compile common clustering questions and answers from mailing lists and JIRA. | 2-3 days | Medium | | 75.7 | `docs/tribes/developers.xml:33` | Empty TODO placeholder | Developer guide for extending Tribes: custom channels, interceptors, senders. | 2-3 days | Medium | -**Total estimated effort: 9-14 days, Medium difficulty** +**Total estimated effort: 7-11 days, Medium difficulty** --- @@ -1035,15 +1034,15 @@ These are IDE-generated stub methods with `// TODO Auto-generated method stub` c | High-Priority TODOs | ~25 | ~50-80 | Medium-High | | Medium-Priority TODOs | ~20 | ~25-40 | Medium | | Low-Priority / Cosmetic | ~15 | ~25-45 | Low-Medium | -| Documentation | 9 | ~14-22 | Medium | +| Documentation | 8 | ~12-19 | Medium | | Test Code | ~20 | ~15-25 | Low-Medium | | Auto-Generated Stubs | ~90 | ~5-8 | Low | -| **Total** | **~194** | **~189-270** | **Mixed** | +| **Total** | **~193** | **~187-267** | **Mixed** | ### Priority Recommendations 1. **Immediate**: Fix DeltaManager session replication (items 1.1-1.7) - these affect cluster correctness 2. **Short-term**: Fix DBCP double-close (6.1-6.2), BaseModelMBean notification removal (7.1), PersistentManagerBase LRU (5.1) 3. **Medium-term**: SSL rewrite variables (2.1-2.8), HTTP/2 HPACK optimization (23.1-23.3), ThreadPoolExecutor AQS (13.1) -4. **Long-term**: WebXml i18n support (30.1), CGIServlet overhaul (63.1), Tribes documentation (75.3, 75.5-75.7) +4. **Long-term**: WebXml i18n support (30.1), CGIServlet overhaul (63.1), Tribes documentation (75.3, 75.6-75.7) 5. **Backlog**: Auto-generated stubs, cosmetic items, test improvements diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 5ed178a2d0ae..448854d7ffb8 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -490,6 +490,11 @@ + + Add an Apache Tribes interceptor guide covering message and membership + processing, interceptor ordering, configuration and custom extension + guidance. (sainadh777) + Add documentation for multicast, static and cloud membership in Apache Tribes, including failure detection, security and troubleshooting diff --git a/webapps/docs/tribes/interceptors.xml b/webapps/docs/tribes/interceptors.xml index e7949f093683..50f47e043474 100644 --- a/webapps/docs/tribes/interceptors.xml +++ b/webapps/docs/tribes/interceptors.xml @@ -20,18 +20,252 @@ ]> - &project; + &project; - - Apache Tribes - Interceptors - + + Apache Tribes - Interceptors + +
+ +
+ +
+

+ A Tribes channel uses a chain of interceptors between the application-facing + GroupChannel and the transport and membership components. An + interceptor can transform a message, change how it is delivered, observe + traffic, or filter membership events. This keeps each concern independent + of the channel and transport implementations. +

+

+ Interceptors are added with nested Interceptor elements in the + order in which they should process outbound messages. Inbound messages and + membership events travel through the same chain in reverse order. For the + following stack, outbound messages pass through A, then + B, while inbound messages pass through B, then + A: +

+ + + +]]> +

+ An interceptor normally calls the next interceptor when sending and the + previous interceptor when receiving. It may instead consume a message, + create additional messages, delay delivery, or report an error. Therefore, + both the selected interceptors and their order are part of the cluster + protocol and should be consistent on every member. +

+
-
-

TODO

+
+

+ A channel message carries a bit mask of send options. An interceptor with + an optionFlag of zero processes every message. A non-zero flag + allows the interceptor to process only messages that contain all of its + configured bits. Some interceptors use a fixed or internal option bit. For + example, MessageDispatchInterceptor reacts to + SEND_OPTIONS_ASYNCHRONOUS, while + GzipInterceptor marks compressed messages so that the receiver + knows to decompress them. +

+

+ Custom option bits must not overlap. Set optionCheck="true" on + the channel during configuration to make startup fail when two + interceptors claim the same non-zero flag. The standard delivery options + are described in the transport + guide. +

+ +
+ +

+ MessageDispatchInterceptor queues messages marked with + SEND_OPTIONS_ASYNCHRONOUS and sends them from its worker + pool. A queue size limit bounds the retained message data. When the queue + is full, alwaysSend determines whether the caller sends the + message synchronously or receives an error. +

+

+ Its position controls which outbound work is asynchronous. Interceptors + before it run on the caller's thread; interceptors after it run on a + dispatch worker. If no interceptors are configured, + GroupChannel adds this interceptor automatically. Once an + explicit stack is configured, include it explicitly when asynchronous + delivery is required. +

+
+ + +

+ FragmentationInterceptor splits messages larger than + maxSize and reassembles the fragments at the destination. + Incomplete fragment sets are discarded after expire. This + can prevent one large message from monopolising a connection, but it also + retains fragments in memory until the message is complete or expires. +

+
+ + +

+ GzipInterceptor compresses outbound payloads with GZIP when + they exceed compressionMinSize and decompresses marked + inbound payloads. Compression reduces network traffic for suitable data + at the cost of CPU time. Place it before + FragmentationInterceptor to compress a complete message + before splitting it; the reverse inbound path then reassembles the + message before decompression. +

+
+ + +

+ OrderInterceptor adds a sequence number per destination and + queues out-of-order inbound messages. The expire, + maxQueue and forwardExpired settings bound how + long and how many messages it retains, and determine whether gaps result + in late messages being forwarded or discarded. Ordering can reduce + throughput when many threads send concurrently, so enable it only for + messages whose semantics require it. +

+
+ + +

+ TwoPhaseCommitInterceptor sends a confirmation after each + message. The receiver releases the original only after the confirmation + arrives. It does not retransmit a lost message or confirmation, so it is + a delivery-ordering mechanism rather than a transaction manager. +

+

+ When it is combined with FragmentationInterceptor, declare + TwoPhaseCommitInterceptor first. This makes it confirm the + complete message rather than individual fragments that share the same + message identifier. +

+
+
+ +
+ +

+ TcpFailureDetector checks a member over TCP before accepting + a disappearance event, and also reacts to message send failures. It helps + distinguish an unavailable member from delayed or lost membership + announcements. Connection and optional read tests have independent + timeouts so that failure confirmation can be tuned for the network. +

+

+ TcpPingInterceptor actively sends periodic pings. It may use + the channel heartbeat or a dedicated thread, and it can limit checks to + statically configured members. Place it before + TcpFailureDetector so it can use the detector's membership + checks. +

+
+ + +

+ StaticMembershipInterceptor adds configured local and remote + members to the view without requiring dynamic discovery. It may be used + alone or with a dynamic membership service. Place it after + TcpFailureDetector so the configured members receive the + same failure checks as dynamically discovered members. The + membership guide + contains complete examples and ordering guidance. +

+
+ + +

+ DomainFilterInterceptor exposes only members and messages + whose member domain matches its configured domain. It provides logical + separation when discovery traffic is shared. It is not a security + boundary: untrusted cluster traffic still requires the network and TLS + protections described in the + cluster security reference. +

+
+ + +

+ SimpleCoordinator derives a stable, sorted member view and + selects its first member as coordinator. + NonBlockingCoordinator adds a distributed view-merging and + leader-election protocol. These are specialised building blocks for + applications using Tribes directly and are not normally required for + Tomcat session replication. +

+
+
+ +
+

+ ThroughputInterceptor counts transmitted and received messages, + bytes and send failures, and periodically logs transfer rates. It does not + change message delivery. The interceptor and several other built-ins + expose runtime state through JMX when channel JMX registration is enabled. + See the status and monitoring guide for object + names and useful attributes. +

+

+ The channel also invokes heartbeat() periodically. Interceptors + use this callback to expire fragments, ordering queues, confirmations and + other temporary state. If the channel's internal heartbeat is disabled, + the embedding application or container must provide the equivalent + periodic callback. +

+
+ +
+

+ The following stack checks member failures, permits asynchronous sends, + compresses larger messages and fragments the compressed representation. + Each cluster member should use the same message-processing stack and + compatible settings. +

+ + + + + +]]> +

+ The interceptor configuration + reference lists the supported attributes and defaults for interceptors + intended for Tomcat cluster configurations. The + interceptor + package API covers the specialised implementations. +

+
+ +
+

+ Custom interceptors should extend ChannelInterceptorBase and + override only the callbacks they need. Outbound processing must normally + finish by calling super.sendMessage(); inbound processing and + membership notifications must normally finish by calling the corresponding + superclass method. Omitting that call intentionally consumes the event. +

+

+ A single interceptor instance is shared by sending threads, receiver worker + threads and heartbeat processing. Mutable state must therefore be safe for + concurrent access, callbacks should avoid blocking the stack unnecessarily, + and retained messages must be cloned if their buffers may be reused by the + caller. Release temporary state during heartbeat or shutdown, and use an + application-specific, non-conflicting bit when the interceptor needs an + optionFlag. +

+
+