v3.0.4 LoginProcessor is renamed to InspectionProcessor

prototype
Yan 7 months ago
parent b580a25efd
commit 4bfe1461d2

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>camel-springboot-activemq6-example</artifactId>
<version>3.0.3</version>
<version>3.0.4</version>
<name>camel-springboot-activemq6-example</name>
<properties>

@ -3,7 +3,7 @@ package com.example.sbcamel.init;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.example.sbcamel.processor.LoginProcessor;
import com.example.sbcamel.processor.InspectionProcessor;
import com.fasterxml.jackson.jakarta.rs.json.JacksonJsonProvider;
@Configuration
@ -15,7 +15,7 @@ public class AppConfig {
}
@Bean
public LoginProcessor loginProcessor() {
return new LoginProcessor();
public InspectionProcessor inspectionProcessor() {
return new InspectionProcessor();
}
}

@ -13,7 +13,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import com.example.sbcamel.mapper.SessionMapper;
import com.example.sbcamel.processor.LoginProcessor;
import com.example.sbcamel.processor.InspectionProcessor;
import com.example.sbcamel.service.SessionService;
import jakarta.annotation.PostConstruct;
@ -31,7 +31,7 @@ public class CamelRouter extends RouteBuilder {
private JdbcTemplate jdbcTemplate;
@Autowired
protected LoginProcessor loginProcessor;
protected InspectionProcessor inspectionProcessor;
@PostConstruct
private void init() {
@ -73,7 +73,7 @@ public class CamelRouter extends RouteBuilder {
.to("mybatis:" + SessionMapper.class.getName() + ".findSession?statementType=SelectOne")
.when(header(BeanConstants.BEAN_METHOD_NAME).isEqualTo("login"))
.to("mybatis:" + SessionMapper.class.getName() + ".findSession?statementType=SelectOne")
.process(loginProcessor).end().marshal().json(JsonLibrary.Jackson);
.process(inspectionProcessor).end().marshal().json(JsonLibrary.Jackson);
}
}

@ -14,9 +14,9 @@ import org.springframework.beans.factory.annotation.Value;
import com.example.sbcamel.service.Session;
public class LoginProcessor implements Processor {
public class InspectionProcessor implements Processor {
private static final Logger logger = LoggerFactory.getLogger(LoginProcessor.class);
private static final Logger logger = LoggerFactory.getLogger(InspectionProcessor.class);
@Value("${app.htmlunit.login-url}")
private String loginUrl;
@ -30,6 +30,15 @@ public class LoginProcessor implements Processor {
@Value("${app.htmlunit.user-page-url}")
private String userPageUrl;
@Value("${app.htmlunit.vip1-page-url}")
private String vip1PageUrl;
@Value("${app.htmlunit.vip2-page-url}")
private String vip2PageUrl;
@Value("${app.htmlunit.vip3-page-url}")
private String vip3PageUrl;
@Value("${app.htmlunit.logout-url}")
private String logoutUrl;
@ -58,7 +67,16 @@ public class LoginProcessor implements Processor {
Thread.sleep(loginWaitMillis);
HtmlPage userPage = webClient.getPage(userPageUrl);
logger.info("loginBtn clicked, userPage: {}", userPage.asXml());
logger.info("userPage: {}", userPage.asXml());
HtmlPage vip1Page = webClient.getPage(vip1PageUrl);
logger.info("vip1Page: {}", vip1Page.asXml());
HtmlPage vip2Page = webClient.getPage(vip2PageUrl);
logger.info("vip2Page: {}", vip2Page.asXml());
HtmlPage vip3Page = webClient.getPage(vip3PageUrl);
logger.info("vip3Page: {}", vip3Page.asXml());
HtmlPage logoutPage = webClient.getPage(logoutUrl);
logger.info("logoutPage: {}", logoutPage.asXml());
Loading…
Cancel
Save