Skip to content

Better documentation for writing custom channel adapters for JavaDSL #3725

Open

Description

@migroskub

Expected Behavior
I think there should be an how to write channel adapter guide with examples for:

  • Reactive event-driven inbound channel adapters
  • Reactive source polling inbound channel adapters
  • Reactive outbound channel adapters
  • Event-driven inbound channel adapters
  • Source polling inbound channel adapters
  • Outbound channel adapters

There should be super simple examples for writing each with the JavaDSL, and more important - explanations about the interfaces that are required for each usage (and which ones are supported with nio Reactive Programming). Such as:

  • MessageProducerSupport
  • AbstractMessageSource
  • AbstractReactiveMessageHandler
  • AbstractMessageHandler
  • AbstractReplyProducingMessageHandler
    and more (I don't know of more relevant interfaces, this is one of the reasons I'm raising this issue).
    There should be examples for the differences between them and use cases for each.

Current Behavior

It's pretty hard to understand what are the correct interfaces that we should use in each case of writing channel adapters with the Java DSL. I think there should be a better guide for writing custom channel adapters (since there are not so many channel adapters, writing custom ones is a pretty common task, if not the most common task when using Spring Integration).

Context
The reference doesn't mention any of the JavaDSL channel adapter interfaces, so that's super hard to understand the purpose of each interface and what fits my needs. The only solution what diving into the source code, which has inconsistency between channel adapters (some channel adapters name is XInboundChannelAdapter, and some channel adapters name is XMessageProducer. I know that there may be some reasons and conventions to it, but this whole part is just not documented).

Activity

  1. added
    status: waiting-for-triage
    on Feb 11, 2022
  2. artembilan commented on Feb 11, 2022

    @artembilan
    Member

    Just to be sure that we are on the same page: writing channel adapters is fully irrelevant if they are used in Java DSL or not.
    The Java DSL is just a hing-level syntax sugar on top of EIP components. It does not require particular channel adapter to be implemented: you always can use POJO methods to be invoked invoked from generic Service Activator (handle() in terms of Java DSL).
    You also may not look deep into reactive inbound channel adapter since Java DSL provides a factory like this: IntegrationFlows.from(Publisher<? extends Message<?>> publisher).

    To be honest we don't provide such a guidance because we don't expect it to be regular task for framework users.
    It is more advance one for those who wants develop channel adapter libraries or contribute back to the framework.

    Anyway, we will look into this in the nearest future.

    Thank you!

  3. added and removed
    status: waiting-for-triage
    on Feb 11, 2022
  4. added this to the 6.0.x milestone on Feb 11, 2022
  5. migroskub commented on Feb 26, 2022

    @migroskub
    ContributorAuthor

    It's just super hard to understand if some channel adapter fits my use case. For example if I want to know whether some channel adapter fits my need, for example the S3 message handler, I need to somehow understand if AbstractReplyProducingMessageHandler is supported by Reactive Programming or not (or whether it depends on each implementation).

  6. artembilan commented on Feb 28, 2022

    @artembilan
    Member

    See this docs: https://docs.spring.io/spring-integration/docs/current/reference/html/reactive-streams.html#reactive-reply-payload for some insight.
    And yes: it is really per MessageHandler impl to determine if it is reactive or not, or can fit to reactive processing downstream if its result is an async.
    This is a doc for that S3MessageHandler when it is used for request-reply scenario: https://github.com/spring-projects/spring-integration-aws#outbound-gateway.

    I agree that we lack some clearer documentation on the matter yet, so that why this issue is accepted for improvement for the current version.

  7. artembilan commented on Mar 8, 2022

    @artembilan
    Member

    Yes, we are planning to address this issue in the current 6.0 timeline.

  8. modified the milestones: 6.0.x, Backlog on Jan 17, 2023
  9. rpenaganti commented on Jun 17, 2026

    @rpenaganti

    Hi, I would like to work on this documentation improvement for custom channel adapters in the Java DSL.
    I am planning to add a section in the reference docs with a simple example and step‑by‑step guidance.
    Please let me know if you have any specific expectations or existing examples you’d like me to follow.

  10. artembilan commented on Jun 17, 2026

    @artembilan
    Member

    @rpenaganti ,

    Thank you for suggesting the help!

    The problem with this task that you need to be fully on board with the framework API to document something for a "custom" scope.
    Furthermore, I think there is some mix of concerns in this ticket.
    It does not really state clear what should be documented.

    The custom channel adapter is an implementation of the MessageSource, MessageProducerSupport, MessagingGatewaySupport or MessageHandlerSupport.
    Or even MessageChannel.
    That's one subject I was able to derive from this ticket.

    Another one is what reactive and what is not.
    Which states aside of custom channel adapter request.

    And one more is Java DSL.
    Which is just an evolution of the first subject with respective API to be extended.

    We do have some explanation of those classes in our doc: https://docs.spring.io/spring-integration/reference/overview.html#finding-class-names-for-java-and-dsl-configuration.
    And every single other existing chapter contributes this or other way to the request in this ticket.
    I mean what else could be written better than the whole reference doc we already have?

    Any ideas are welcome!

  11. rpenaganti commented on Jun 17, 2026

    @rpenaganti

    @artembilan

    Thank you for the detailed explanation and for pointing out the overlap of concerns in this ticket.

    I understand that documenting “custom channel adapters” in a general way requires a solid grasp of the framework APIs (MessageSource, MessageProducerSupport, MessagingGatewaySupport, MessageHandlerSupport, MessageChannel, etc.), and that much of this is already described across the reference documentation you linked.

    To make sure I don’t duplicate what’s already there or go in the wrong direction, could you please clarify what kind of additional documentation would be most helpful from your perspective? For example, would a focused walkthrough showing a concrete end‑to‑end example (implementing a simple custom adapter, registering it in Java DSL, and wiring it into a flow) add value, or is the main need more about clarifying the distinction between reactive and non‑reactive components?

    If you can share a preferred angle (e.g., “one practical example-based section” vs. “clarify reactive vs non‑reactive for custom adapters”), I would be happy to draft something along those lines and propose it for your review.

  12. artembilan commented on Jun 17, 2026

    @artembilan
    Member

    I think the new chapter should be like:

    How to implement custom integration component?

    Explain (shortly) different types of integration component.
    The IntegrationPatternCategory should be a good start to determine them.
    With links to respective existing chapters about this or that component.

    How to implement custom message channel?

    See MessageChannel abstraction and AbstractMessageChannel.
    I doubt it is a common use-case to implement custom message channel. Not so easy to justify a requirements for such a dedicated component.
    See PartitionedChannel or FluxMessageChannel, for example.
    However, something like protocol-specific channel is real task.

    How to implement custom polling inbound channel adapter?

    See SourcePollingChannelAdapter which does not need any re-implementations.
    But see closer to the MessageSource and AbstractMessageSource

    How to implement custom message-driven channel adapter?

    See MessageProducerSupport

    How to implement custom inbound gateway?

    See MessageProducerSupport

    How to implement custom outbound channel adapter and gateway?

    See MessageHandler, ReactiveMessageHandler, MessageHandlerSupport and AbstractReplyProducingMessageHandler

    How to implement custom transformer?

    See Transformer and AbstractTransformer or even AbstractPayloadTransformer

    And probably so on for all the integration patterns.

    Not sure though what kind of examples you could give there since in most cases the "custom" means an implementation for some specific protocol.
    For, example we don't have channel adapters for Neo4J.
    But if we got them "customly" implemented why don't contribute them back to the project?

    If you going to do this new doc with the help of AI, please, give it a decent human proof-reading before opening pull request.
    That would be a lot of time wasting on my side reviewing something which might be far from reality.

    Thank you for understanding!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions