Spring JPA configuration Demo

本文介绍了一个使用 Spring Integration 框架结合 JPA 实现的数据处理流程配置案例。该配置包括了数据查询、状态检查、进一步的数据检索及最终通过 JMS 发送报告的完整过程。涉及到 Spring Integration 的各种组件如 channel、service-activator 和 outbound-gateway 的应用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:int="http://www.springframework.org/schema/integration"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:int-stream="http://www.springframework.org/schema/integration/stream"
xmlns:int-jpa="http://www.springframework.org/schema/integration/jpa" xmlns:oxm="http://www.springframework.org/schema/oxm"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-2.2.xsd
http://www.springframework.org/schema/integration/jpa
http://www.springframework.org/schema/integration/jpa/spring-integration-jpa-2.2.xsd
http://www.springframework.org/schema/integration/stream
http://www.springframework.org/schema/integration/stream/spring-integration-stream.xsd
http://www.springframework.org/schema/oxm
http://www.springframework.org/schema/oxm/spring-oxm-3.2.xsd">

<int:channel id="queryJobListChannel" />
<int:channel id="startupJobChannel" />

<int-jpa:inbound-channel-adapter id="testJobName" auto-startup="${auto.start}" entity-manager="em"
send-timeout="${channel.default.timeout}" channel="queryJobListChannel" expect-single-result="true"
jpa-query="SELECT job FROM JobEntity job WHERE job.jobBeanId='testJobName' ">
<int:poller fixed-delay="${poll.interval}" />
</int-jpa:inbound-channel-adapter>

<int:service-activator id="jobStatusServiceActivator" ref="jobStatusService" method="checkJobStatus"
input-channel="queryJobListChannel" output-channel="startupJobChannel" />
<bean id="jobStatusService" class="com.xxx.service.JobStatusService" />


<int-jpa:retrieving-outbound-gateway id="queryRunDayGateway" entity-manager="em"
expect-single-result="true" request-channel="startupJobChannel" reply-channel="queryBListChannel"
jpa-query="SELECT sf FROM Aentity sf">
</int-jpa:retrieving-outbound-gateway>


<int:channel id="queryBListChannel" />
<int-jpa:retrieving-outbound-gateway id="queryCashTranListAdapter" entity-manager="em"
request-channel="queryBListChannel" reply-channel="sendJmsChannel"
jpa-query="SELECT A, B FROM XXA AS A, XXB AS B WHERE A.id = B.id
AND B.createOn = :runDate "
>
<int-jpa:parameter expression="payload.sysDate" name="runDate" />
</int-jpa:retrieving-outbound-gateway>

<int:channel id="sendJmsChannel" />
<int:service-activator id="sendReportActivator" input-channel="sendJmsChannel" ref="jmsSender"
method="send" />

<bean id="jmsSender" class="com.xx.service.JmsSenderService">
<constructor-arg ref="jmsTemplate" />
<property name="retryTimes" value="${jms.send.retryTimes}" />
</bean>

</beans>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值