mirror of
https://github.com/OtusTeam/Spring.git
synced 2026-05-30 10:50:42 +00:00
examples updated
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.5.2</version>
|
||||
<version>2.5.5</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
|
||||
|
||||
+11
-1
@@ -9,6 +9,7 @@ import org.springframework.integration.dsl.IntegrationFlowDefinition;
|
||||
import org.springframework.integration.dsl.MessageChannels;
|
||||
import org.springframework.integration.dsl.Pollers;
|
||||
import org.springframework.integration.scheduling.PollerMetadata;
|
||||
import org.springframework.mail.SimpleMailMessage;
|
||||
import org.springframework.mail.javamail.JavaMailSender;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.PollableChannel;
|
||||
@@ -16,6 +17,8 @@ import ru.otus.example.springmail_integration_demo.repositories.ActivityReposito
|
||||
import ru.otus.example.springmail_integration_demo.repositories.ActivityStatRepository;
|
||||
import ru.otus.example.springmail_integration_demo.services.UserActivityToEmailTransformer;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
|
||||
@Configuration
|
||||
@IntegrationComponentScan
|
||||
@@ -42,6 +45,8 @@ public class IntegrationConfig {
|
||||
@Autowired
|
||||
private JavaMailSender mailSender;
|
||||
|
||||
private AtomicBoolean messageWasSandedOnceFlag = new AtomicBoolean(false);
|
||||
|
||||
@Bean
|
||||
public PollableChannel appUserActivityInChanel() {
|
||||
return MessageChannels.queue("appUserActivityInChanel", DEFAULT_QUEUE_CAPACITY).get();
|
||||
@@ -66,7 +71,12 @@ public class IntegrationConfig {
|
||||
.transform(messageTransformer, TRANSFORM_METHOD_NAME)
|
||||
.handle(m -> {
|
||||
System.out.println("Как будто посылаем письмо: " + m.getPayload());
|
||||
//mailSender.send((SimpleMailMessage) m.getPayload());
|
||||
/*
|
||||
if (!messageWasSandedOnceFlag.get()) {
|
||||
mailSender.send((SimpleMailMessage) m.getPayload());
|
||||
messageWasSandedOnceFlag.set(true);
|
||||
}
|
||||
*/
|
||||
})
|
||||
)
|
||||
.subFlowMapping(false, IntegrationFlowDefinition::nullChannel)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.5.2</version>
|
||||
<version>2.5.5</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<version>2.10.1</version>
|
||||
<version>2.13.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -32,7 +32,7 @@
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.20</version>
|
||||
<version>1.18.22</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.5.2</version>
|
||||
<version>2.5.5</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user