Skip to content

Commit

Permalink
Fix code typos in filter.adoc & router.adoc
Browse files Browse the repository at this point in the history
* Fix race condition in the `JdbcPollingChannelAdapterParserTests`
making SELECT and UPDATE as a part of the same transaction
* Remove `inProcess = JAVA_EXEC` from ASCIIDoc Gradle tasks in attempt
to make them working in parallel
  • Loading branch information
artembilan committed Jun 7, 2023
1 parent 0cf81db commit 7655d97
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 15 deletions.
2 changes: 0 additions & 2 deletions gradle/docs.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ task prepareDocs(type: Copy) {
asciidoctorPdf {
dependsOn prepareDocs

inProcess = JAVA_EXEC
forkOptions {
jvmArgs '--add-opens', 'java.base/sun.nio.ch=ALL-UNNAMED', '--add-opens', 'java.base/java.io=ALL-UNNAMED'
}
Expand All @@ -106,7 +105,6 @@ asciidoctorPdf {
asciidoctor {
dependsOn asciidoctorPdf

inProcess = JAVA_EXEC
forkOptions {
jvmArgs '--add-opens', 'java.base/sun.nio.ch=ALL-UNNAMED', '--add-opens', 'java.base/java.io=ALL-UNNAMED'
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -22,8 +22,8 @@

import javax.sql.DataSource;

import org.junit.After;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;

import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
Expand Down Expand Up @@ -177,7 +177,7 @@ public void testAutoChannel() {
assertThat(TestUtils.getPropertyValue(autoChannelAdapter, "outputChannel")).isSameAs(autoChannel);
}

@After
@AfterEach
public void tearDown() {
if (appCtx != null) {
appCtx.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
<si:queue />
</si:channel>

<si:poller default="true" fixed-delay="100"/>
<si:poller default="true" fixed-delay="100">
<si:transactional/>
</si:poller>

<jdbc:embedded-database type="HSQL" id="dataSource">
<jdbc:script location="org/springframework/integration/jdbc/config/inboundSchema.sql" />
Expand Down
4 changes: 3 additions & 1 deletion src/reference/asciidoc/filter.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ The following example shows how to configure a filter that uses the `method` att
<bean id="exampleObject" class="example.SomeObject"/>
----
====

If the selector or adapted POJO method returns `false`, a few settings control the handling of the rejected message.
By default, (if configured as in the preceding example) rejected messages are silently dropped.
If rejection should instead result in an error condition, set the `throw-exception-on-rejection` attribute to `true`, as the following example shows:
Expand Down Expand Up @@ -223,6 +223,7 @@ However, the underlying functionality of evaluating the expression against the m

The following example shows how to configure a filter by using annotations:

====
[source,java]
----
public class PetFilter {
Expand All @@ -233,6 +234,7 @@ public class PetFilter {
}
}
----
====

<1> An annotation indicating that this method is to be used as a filter.
It must be specified if this class is to be used as a filter.
Expand Down
15 changes: 8 additions & 7 deletions src/reference/asciidoc/router.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -530,9 +530,6 @@ If you want to suppress such exceptions and send unresolved messages to the defa
Normally, messages for which the header value is not explicitly mapped to a channel are sent to the `default-output-channel`.
However, when the header value is mapped to a channel name but the channel cannot be resolved, setting the `resolution-required` attribute to `false` results in routing such messages to the `default-output-channel`.

IMPORTANT: As of Spring Integration 2.1, the attribute was changed from `ignore-channel-name-resolution-failures` to `resolution-required`.
Attribute `resolution-required` defaults to `true`.

The following example shows the equivalent router configured in Java:

====
Expand Down Expand Up @@ -695,13 +692,15 @@ Another convenient option when configuring a `RecipientListRouter` is to use Spr
Doing so is similar to using a filter at the beginning of a 'chain' to act as a "`selective consumer`".
However, in this case, it is all combined rather concisely into the router's configuration, as the following example shows:

====
[source,xml]
----
<int:recipient-list-router id="customRouter" input-channel="routingChannel">
<int:recipient channel="channel1" selector-expression="payload.equals('foo')"/>
<int:recipient channel="channel2" selector-expression="headers.containsKey('bar')"/>
</int:recipient-list-router>
----
====

In the preceding configuration, a SpEL expression identified by the `selector-expression` attribute is evaluated to determine whether this recipient should be included in the recipient list for a given input message.
The evaluation result of the expression must be a `boolean`.
Expand All @@ -725,7 +724,6 @@ They are available by using <<./control-bus.adoc#control-bus,Control Bus>> as we
<channel id="channel2"/>
----
[source,java]
----
messagingTemplate.convertAndSend(controlBus, "@'simpleRouter.handler'.addRecipient('channel2')");
Expand Down Expand Up @@ -803,6 +801,7 @@ someFlow() {
}
----
[source, xml, role="secondary"]
.XML DSL
----
<int:exception-type-router input-channel="inputChannel"
default-output-channel="defaultChannel">
Expand Down Expand Up @@ -993,10 +992,12 @@ public IntegrationFlow routerFlow() {

To simplify things even more, the SpEL expression may evaluate to a channel name, as the following expression shows:

====
[source,xml]
----
<int:router input-channel="inChannel" expression="payload + 'Channel'"/>
----
====

In the preceding configuration, the result channel is computed by the SpEL expression, which concatenates the value of the `payload` with the literal `String`, 'Channel'.

Expand All @@ -1019,7 +1020,7 @@ For further information, see:
* https://docs.spring.io/spring-framework/docs/current/spring-framework-reference/core.html#expressions-collection-selection[Collection Selection]

[[router-annotation]]
===== Configuring a Router with Annotations
==== Configuring a Router with Annotations

When using `@Router` to annotate a method, the method may return either a `MessageChannel` or a `String` type.
In the latter case, the endpoint resolves the channel name as it does for the default output channel.
Expand Down Expand Up @@ -1135,7 +1136,7 @@ However, if you look at the alternate configuration of the `HeaderValueRouter` w
====
[source,xml]
----
<int:header-value-router input-channel="inputChannel" header-name="testHeader">
<int:header-value-router input-channel="inputChannel" header-name="testHeader"/>
----
====

Expand Down Expand Up @@ -1214,7 +1215,7 @@ You can also use Spring's JMX support to expose a router instance and then use y
NOTE: For more information about Spring Integration's JMX support, see <<./jmx.adoc#jmx,JMX Support>>.

[[routing-slip]]
===== Routing Slip
==== Routing Slip

Starting with version 4.1, Spring Integration provides an implementation of the https://www.enterpriseintegrationpatterns.com/RoutingTable.html[routing slip] enterprise integration pattern.
It is implemented as a `routingSlip` message header, which is used to determine the next channel in `AbstractMessageProducingHandler` instances, when an `outputChannel` is not specified for the endpoint.
Expand Down

0 comments on commit 7655d97

Please sign in to comment.