parent
13436df52c
commit
1cef5e5d65
@ -0,0 +1,9 @@
|
||||
{
|
||||
"version": "1",
|
||||
"name": "camel-springboot-xml-example",
|
||||
"type": "collection",
|
||||
"ignore": [
|
||||
"node_modules",
|
||||
".git"
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
auth {
|
||||
mode: basic
|
||||
}
|
||||
|
||||
auth:basic {
|
||||
username:
|
||||
password:
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
meta {
|
||||
name: findSession
|
||||
type: http
|
||||
seq: 4
|
||||
}
|
||||
|
||||
get {
|
||||
url: http://localhost:8761/services/api/session/d4415f6c-da1d-435c-95be-73bafe165768
|
||||
body: none
|
||||
auth: basic
|
||||
}
|
||||
|
||||
headers {
|
||||
operationName: findUsers
|
||||
}
|
||||
|
||||
auth:basic {
|
||||
username: cxfrs
|
||||
password: password
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
meta {
|
||||
name: findSessions
|
||||
type: http
|
||||
seq: 2
|
||||
}
|
||||
|
||||
get {
|
||||
url: http://localhost:8761/services/api/session
|
||||
body: none
|
||||
auth: basic
|
||||
}
|
||||
|
||||
headers {
|
||||
operationName: findUsers
|
||||
}
|
||||
|
||||
auth:basic {
|
||||
username: cxfrs
|
||||
password: password
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
meta {
|
||||
name: updateSession
|
||||
type: http
|
||||
seq: 3
|
||||
}
|
||||
|
||||
post {
|
||||
url: http://localhost:8761/services/api/session
|
||||
body: json
|
||||
auth: basic
|
||||
}
|
||||
|
||||
headers {
|
||||
Content-Type: application/json
|
||||
X-MethodName: updateUser
|
||||
}
|
||||
|
||||
auth:basic {
|
||||
username: cxfrs
|
||||
password: password
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"sessionId": "{{uuid}}",
|
||||
"username": "admin",
|
||||
"password": "@dminPwd123"
|
||||
}
|
||||
}
|
||||
|
||||
script:pre-request {
|
||||
bru.setVar('uuid', require("uuid").v4());
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration scan="true">
|
||||
<appender name="STDOUT"
|
||||
class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>%-5level %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %logger{36} - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
<appender name="FILE"
|
||||
class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>logs/server.log</file>
|
||||
<rollingPolicy
|
||||
class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>logs/server.%d{yyyy-MM-dd}.log.gz</fileNamePattern>
|
||||
<maxHistory>3</maxHistory>
|
||||
<totalSizeCap>300MB</totalSizeCap>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>%-5level %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %logger{36} - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
<logger name="org.htmlunit" level="OFF"/>
|
||||
<root level="INFO">
|
||||
<appender-ref ref="STDOUT" />
|
||||
</root>
|
||||
</configuration>
|
||||
@ -0,0 +1,21 @@
|
||||
server:
|
||||
port: 8761
|
||||
|
||||
camel:
|
||||
springboot:
|
||||
main-run-controller: true
|
||||
|
||||
spring:
|
||||
ldap:
|
||||
urls: ldap://localhost:10389
|
||||
base: dc=example,dc=com
|
||||
username: uid=admin,ou=system
|
||||
password: secret
|
||||
|
||||
app:
|
||||
queue-name: "SessionServiceQueue"
|
||||
database:
|
||||
url: "jdbc:h2:tcp://localhost/~/h2/db/appdb"
|
||||
username: "app"
|
||||
password: "app"
|
||||
mapper-package: "com.example.sbcamel.mapper"
|
||||
@ -1,142 +0,0 @@
|
||||
package com.example.sbcamel.processor;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.camel.Exchange;
|
||||
import org.apache.camel.Processor;
|
||||
import org.htmlunit.FailingHttpStatusCodeException;
|
||||
import org.htmlunit.WebClient;
|
||||
import org.htmlunit.html.HtmlButton;
|
||||
import org.htmlunit.html.HtmlForm;
|
||||
import org.htmlunit.html.HtmlPage;
|
||||
import org.htmlunit.html.HtmlPasswordInput;
|
||||
import org.htmlunit.html.HtmlTextInput;
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.nodes.Document;
|
||||
import org.jsoup.nodes.Element;
|
||||
import org.jsoup.select.Elements;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
||||
import com.example.sbcamel.service.Session;
|
||||
|
||||
public class InspectionProcessor implements Processor {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(InspectionProcessor.class);
|
||||
|
||||
@Value("${app.htmlunit.login-url}")
|
||||
private String loginUrl;
|
||||
|
||||
@Value("${app.htmlunit.login-btn-selector}")
|
||||
private String loginBtnSelector;
|
||||
|
||||
@Value("${app.htmlunit.login-wait-millis:3000}")
|
||||
private Long loginWaitMillis;
|
||||
|
||||
@Value("${app.htmlunit.user-page-url}")
|
||||
private String userPageUrl;
|
||||
|
||||
@Value("${app.htmlunit.vip11-page-url}")
|
||||
private String vip11PageUrl;
|
||||
|
||||
@Value("${app.htmlunit.vip12-page-url}")
|
||||
private String vip12PageUrl;
|
||||
|
||||
@Value("${app.htmlunit.vip13-page-url}")
|
||||
private String vip13PageUrl;
|
||||
|
||||
@Value("${app.htmlunit.vip21-page-url}")
|
||||
private String vip21PageUrl;
|
||||
|
||||
@Value("${app.htmlunit.vip22-page-url}")
|
||||
private String vip22PageUrl;
|
||||
|
||||
@Value("${app.htmlunit.vip23-page-url}")
|
||||
private String vip23PageUrl;
|
||||
|
||||
@Value("${app.htmlunit.vip31-page-url}")
|
||||
private String vip31PageUrl;
|
||||
|
||||
@Value("${app.htmlunit.vip32-page-url}")
|
||||
private String vip32PageUrl;
|
||||
|
||||
@Value("${app.htmlunit.vip33-page-url}")
|
||||
private String vip33PageUrl;
|
||||
|
||||
@Value("${app.htmlunit.logout-url}")
|
||||
private String logoutUrl;
|
||||
|
||||
@Override
|
||||
public void process(Exchange exchange) throws Exception {
|
||||
Session session = (Session) exchange.getMessage().getBody();
|
||||
logger.debug("session: {}", session);
|
||||
|
||||
try (final WebClient webClient = new WebClient()) {
|
||||
|
||||
final HtmlPage loginPage = webClient.getPage(loginUrl);
|
||||
logger.debug("loginPage: {}", loginPage.asXml());
|
||||
|
||||
final HtmlForm form = loginPage.getForms().get(0);
|
||||
final HtmlTextInput usernameField = form.getInputByName("username");
|
||||
usernameField.type(session.getUsername());
|
||||
logger.debug("entered username: {}", session.getUsername());
|
||||
|
||||
final HtmlPasswordInput passwordField = form.getInputByName("password");
|
||||
passwordField.type(session.getPassword());
|
||||
logger.debug("entered password: {}", session.getPassword());
|
||||
|
||||
HtmlButton loginBtn = loginPage.querySelector(loginBtnSelector);
|
||||
logger.debug("loginBtn type: {}", loginBtn.getType());
|
||||
loginBtn.click();
|
||||
|
||||
Thread.sleep(loginWaitMillis);
|
||||
|
||||
HtmlPage userPage = webClient.getPage(userPageUrl);
|
||||
logger.debug("userPage hashcode: {}", userPage.hashCode());
|
||||
|
||||
Map<String, List<String>> reply11 = fillResponseMap(webClient, session, vip11PageUrl);
|
||||
Map<String, List<String>> reply12 = fillResponseMap(webClient, session, vip12PageUrl);
|
||||
Map<String, List<String>> reply13 = fillResponseMap(webClient, session, vip13PageUrl);
|
||||
|
||||
Map<String, List<String>> reply21 = fillResponseMap(webClient, session, vip21PageUrl);
|
||||
Map<String, List<String>> reply22 = fillResponseMap(webClient, session, vip22PageUrl);
|
||||
Map<String, List<String>> reply23 = fillResponseMap(webClient, session, vip23PageUrl);
|
||||
|
||||
Map<String, List<String>> reply31 = fillResponseMap(webClient, session, vip31PageUrl);
|
||||
Map<String, List<String>> reply32 = fillResponseMap(webClient, session, vip32PageUrl);
|
||||
Map<String, List<String>> reply33 = fillResponseMap(webClient, session, vip33PageUrl);
|
||||
|
||||
webClient.getPage(logoutUrl);
|
||||
exchange.getMessage().setBody(Map.of("vip11Page", reply11, "vip12Page", reply12, "vip13Page", reply13,
|
||||
"vip21Page", reply21, "vip22Page", reply22, "vip23Page", reply23,
|
||||
"vip31Page", reply31, "vip32Page", reply32, "vip33Page", reply33));
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("LoginProcessor process error!", e);
|
||||
}
|
||||
}
|
||||
|
||||
private Map<String, List<String>> fillResponseMap(WebClient webClient, Session session, String url)
|
||||
throws FailingHttpStatusCodeException, MalformedURLException, IOException {
|
||||
Map<String, List<String>> reply = new HashMap<>();
|
||||
HtmlPage vipPage = webClient.getPage(url);
|
||||
Document doc = Jsoup.parse(vipPage.asXml());
|
||||
for (String selector : List.of(session.getSelector1(), session.getSelector2(), session.getSelector3())) {
|
||||
Elements elements = doc.select(selector);
|
||||
List<String> selectedList = new ArrayList<>();
|
||||
for (Element element : elements) {
|
||||
logger.debug("[fillResponseMap] {} -> {}", selector, element.html());
|
||||
selectedList.add(element.html());
|
||||
}
|
||||
reply.put(selector, selectedList);
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,54 +0,0 @@
|
||||
package com.example.sbcamel.processor;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.camel.Exchange;
|
||||
import org.apache.camel.Processor;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.cxf.message.MessageContentsList;
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.nodes.Document;
|
||||
import org.jsoup.nodes.Element;
|
||||
import org.jsoup.select.Elements;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
||||
public class TestProcessor implements Processor {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(TestProcessor.class);
|
||||
|
||||
@Value("${app.jsoup.html-file}")
|
||||
private String htmlFilePath;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void process(Exchange exchange) throws Exception {
|
||||
logger.info("in class: {}", exchange.getIn().getBody().getClass().getName());
|
||||
MessageContentsList mcl = (MessageContentsList) exchange.getIn().getBody();
|
||||
List<String> selectors = (List<String>) mcl.get(0);
|
||||
logger.info("selectors: {}", selectors);
|
||||
|
||||
File htmlFile = new File(htmlFilePath);
|
||||
String html = FileUtils.readFileToString(htmlFile, StandardCharsets.UTF_8);
|
||||
Document doc = Jsoup.parse(html);
|
||||
Map<String, List<String>> reply = new HashMap<>();
|
||||
|
||||
for (String selector : selectors) {
|
||||
Elements elements = doc.select(selector);
|
||||
List<String> selectedList = new ArrayList<>();
|
||||
for (Element element : elements) {
|
||||
logger.info("{} -> {}", selector, element.html());
|
||||
selectedList.add(element.html());
|
||||
}
|
||||
reply.put(selector, selectedList);
|
||||
}
|
||||
exchange.getMessage().setBody(reply);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,70 +0,0 @@
|
||||
package com.example.sbcamel.service;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.mail.Message;
|
||||
import javax.mail.Session;
|
||||
import javax.mail.Transport;
|
||||
import javax.mail.internet.InternetAddress;
|
||||
import javax.mail.internet.MimeMessage;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class EmailService {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(EmailService.class);
|
||||
|
||||
@Autowired
|
||||
private Properties javaMailProperties;
|
||||
|
||||
public boolean sendEmail(String fromAddress, String smtpPassword, String[] toAddresses, String subject,
|
||||
String content) {
|
||||
try {
|
||||
logger.debug("[sendEmail] fromAddress: {}, toAddresses: {}", fromAddress, toAddresses);
|
||||
if (StringUtils.isEmpty(subject) || StringUtils.isEmpty(smtpPassword) || StringUtils.isEmpty(fromAddress)
|
||||
|| toAddresses.length == 0) {
|
||||
logger.warn("[sendEmail] subject, smtp-password, source-address or target-address is not set");
|
||||
return false;
|
||||
}
|
||||
String emailHost = javaMailProperties.getProperty("mail.smtp.host");
|
||||
logger.debug("[sendEmail] {} -> {}, mail.smtp.host: {}", fromAddress, List.of(toAddresses), emailHost);
|
||||
if (StringUtils.isNotBlank(emailHost) && StringUtils.isNotBlank(fromAddress) && toAddresses.length > 0) {
|
||||
logger.debug("[sendEmail] starting to send message from: {}", fromAddress);
|
||||
Session session = Session.getInstance(javaMailProperties);
|
||||
|
||||
MimeMessage message = new MimeMessage(session);
|
||||
message.setContent(content, "text/html; charset=utf-8");
|
||||
message.setFrom(new InternetAddress(fromAddress));
|
||||
|
||||
Arrays.asList(toAddresses).forEach(toAddress -> {
|
||||
try {
|
||||
message.addRecipient(Message.RecipientType.TO, new InternetAddress(toAddress));
|
||||
} catch (Exception e) {
|
||||
logger.error("sendEmail error!", e);
|
||||
}
|
||||
});
|
||||
message.setSubject(subject);
|
||||
|
||||
Transport transport = session.getTransport("smtp");
|
||||
transport.connect(emailHost, fromAddress, smtpPassword);
|
||||
transport.sendMessage(message, message.getAllRecipients());
|
||||
transport.close();
|
||||
logger.debug("sendEmail to: {}", Arrays.asList(toAddresses));
|
||||
|
||||
return true;
|
||||
} else {
|
||||
logger.warn("[sendEmail] missing either from-field, to-field or host address!");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("sendEmail error!", e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -1,161 +0,0 @@
|
||||
package com.example.sbcamel.service;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Base64;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.apache.hc.client5.http.classic.methods.HttpUriRequestBase;
|
||||
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
|
||||
import org.apache.hc.core5.http.ClassicHttpResponse;
|
||||
import org.apache.hc.core5.http.HttpException;
|
||||
import org.apache.hc.core5.http.io.HttpClientResponseHandler;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.google.common.collect.MapDifference;
|
||||
import com.google.common.collect.MapDifference.ValueDifference;
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
public class InspectionClient {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(InspectionClient.class);
|
||||
|
||||
@Autowired
|
||||
private CloseableHttpClient httpClient;
|
||||
|
||||
@Autowired
|
||||
private EmailService emailService;
|
||||
|
||||
@Autowired
|
||||
private ObjectMapper objectMapper;
|
||||
|
||||
@Value("${app.inspection-client.email-password:}")
|
||||
private String smtpPassword;
|
||||
|
||||
@Value("${app.inspection-client.email-sender:}")
|
||||
private String fromAddress;
|
||||
|
||||
@Value("${app.inspection-client.email-recipient:}")
|
||||
private String[] toAddresses;
|
||||
|
||||
@Value("${app.inspection-client.http-url}")
|
||||
private String url;
|
||||
|
||||
@Value("${app.inspection-client.http-method}")
|
||||
private String httpMethod;
|
||||
|
||||
@Value("${app.inspection-client.expected-result-file-path}")
|
||||
private String expectedResultFilePath;
|
||||
|
||||
@Value("${app.inspection-client.alert-subject}")
|
||||
private String alertSubject;
|
||||
|
||||
@Value("${app.inspection-client.http-username}")
|
||||
private String username;
|
||||
|
||||
@Value("${app.inspection-client.http-password}")
|
||||
private String password;
|
||||
|
||||
private static final String getBasicAuthenticationHeader(String username, String password) {
|
||||
String valueToEncode = username + ":" + password;
|
||||
return "Basic " + Base64.getEncoder().encodeToString(valueToEncode.getBytes());
|
||||
}
|
||||
|
||||
public void sendMessage() {
|
||||
try {
|
||||
File jsonFile = new File(expectedResultFilePath);
|
||||
if (!jsonFile.exists()) {
|
||||
logger.info("file does not exist: {}", expectedResultFilePath);
|
||||
return;
|
||||
}
|
||||
String jsonString = FileUtils.readFileToString(jsonFile, StandardCharsets.UTF_8);
|
||||
logger.info("expected result: {}", jsonString);
|
||||
HashMap<String, Object> expectedMap = convertStringToMap(jsonString);
|
||||
logger.info("calling {} {}", httpMethod, url);
|
||||
|
||||
HttpUriRequestBase req = new HttpUriRequestBase(httpMethod, URI.create(url));
|
||||
req.addHeader("Authorization", getBasicAuthenticationHeader(username, password));
|
||||
Pair<Boolean, Boolean> sendEmailResult = httpClient.execute(req,
|
||||
new HttpClientResponseHandler<Pair<Boolean, Boolean>>() {
|
||||
|
||||
@Override
|
||||
public Pair<Boolean, Boolean> handleResponse(ClassicHttpResponse result)
|
||||
throws HttpException, IOException {
|
||||
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
result.getEntity().writeTo(baos);
|
||||
String responseText = new String(baos.toByteArray(), StandardCharsets.UTF_8);
|
||||
logger.info("actual result: {}", responseText);
|
||||
|
||||
if (StringUtils.isEmpty(responseText)) {
|
||||
logger.error("actual result is empty!");
|
||||
return Pair.of(Boolean.FALSE, Boolean.FALSE);
|
||||
}
|
||||
baos.close();
|
||||
try {
|
||||
HashMap<String, Object> resultMap = convertStringToMap(responseText);
|
||||
MapDifference<String, Object> diff = Maps.difference(expectedMap, resultMap);
|
||||
logger.info("diff.areEqual: {}", diff.areEqual());
|
||||
StringBuilder contentBuilder = new StringBuilder();
|
||||
if (!diff.areEqual()) {
|
||||
Map<String, ValueDifference<Object>> entriesDiffering = diff.entriesDiffering();
|
||||
entriesDiffering.entrySet().stream().forEach(entry -> {
|
||||
logger.info("entriesDiffering key: {}", entry.getKey());
|
||||
logger.info("entriesDiffering expected: {}", entry.getValue().leftValue());
|
||||
logger.info("entriesDiffering actual: {}", entry.getValue().rightValue());
|
||||
contentBuilder.append(entry.getKey() + "<br/>\n");
|
||||
contentBuilder.append("EXPECTED: " + entry.getValue().leftValue() + "<br/>\n");
|
||||
contentBuilder.append("ACTUAL: " + entry.getValue().rightValue() + "<br/>\n");
|
||||
contentBuilder.append("<br/>\n");
|
||||
});
|
||||
return Pair.of(Boolean.TRUE, emailService.sendEmail(fromAddress, smtpPassword,
|
||||
toAddresses, alertSubject, contentBuilder.toString()));
|
||||
}
|
||||
} catch (IOException e) {
|
||||
logger.error("Error occurred while parsing message", e);
|
||||
}
|
||||
return Pair.of(Boolean.FALSE, Boolean.FALSE);
|
||||
}
|
||||
|
||||
});
|
||||
logger.info("send email result: {}", sendEmailResult);
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("Error occurred while preparing to send message", e);
|
||||
}
|
||||
}
|
||||
|
||||
public HashMap<String, Object> convertStringToMap(String jsonString) throws IOException {
|
||||
TypeReference<java.util.HashMap<String, Object>> ref = new TypeReference<>() {
|
||||
};
|
||||
return new HashMap<>(objectMapper.readValue(jsonString, ref));
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getHttpMethod() {
|
||||
return httpMethod;
|
||||
}
|
||||
|
||||
public void setHttpMethod(String httpMethod) {
|
||||
this.httpMethod = httpMethod;
|
||||
}
|
||||
}
|
||||
@ -1,19 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:task="http://www.springframework.org/schema/task"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/task https://www.springframework.org/schema/task/spring-task.xsd
|
||||
http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
|
||||
<task:scheduler id="inspectionScheduler" pool-size="2" />
|
||||
|
||||
<bean id="inspectionClient"
|
||||
class="com.example.sbcamel.service.InspectionClient">
|
||||
</bean>
|
||||
|
||||
<task:scheduled-tasks scheduler="inspectionScheduler">
|
||||
<task:scheduled ref="inspectionClient"
|
||||
method="sendMessage" cron="0 * * * * ?" />
|
||||
</task:scheduled-tasks>
|
||||
|
||||
</beans>
|
||||
Loading…
Reference in new issue