-
Notifications
You must be signed in to change notification settings - Fork 602
Dubbo User Guide
流浪诗人丶 edited this page Dec 20, 2017
·
1 revision
<dependency>
<groupId>com.github.myth</groupId>
<artifactId>myth-annotation</artifactId>
</dependency>
@Myth(destination = "account")
boolean payment(AccountDTO accountDTO);
-
-
<dependency> <groupId>com.github.myth</groupId> <artifactId>myth-dubbo</artifactId> </dependency>
-
配置 MythTransactionBootstrap启动类,可以采用xml方式,或者@Bean的方式,具体配置可以参考:配置详解
<context:component-scan base-package="com.github.myth.*"/> <aop:aspectj-autoproxy expose-proxy="true"/> <bean id="mythTransactionBootstrap" class="com.github.myth.core.bootstrap.MythTransactionBootstrap"> <property name="repositorySuffix" value="account-service"/> <property name="serializer" value="kryo"/> <property name="coordinatorQueueMax" value="5000"/> <property name="coordinatorThreadMax" value="8"/> <property name="rejectPolicy" value="Abort"/> <property name="blockingQueueType" value="Linked"/> <property name="repositorySupport" value="db"/> <property name="mythDbConfig"> <bean class="com.github.myth.common.config.MythDbConfig"> <property name="url" value="jdbc:mysql://192.168.1.68:3306/myth?useUnicode=true&characterEncoding=utf8"/> <property name="driverClassName" value="com.mysql.jdbc.Driver"/> <property name="password" value="Wgj@555888"/> <property name="username" value="xiaoyu"/> </bean> </property> </bean>
-
-
@JmsListener(destination = "account",containerFactory = "queueListenerContainerFactory") public void receiveQueue(byte[] message) { LOGGER.info("=========扣减账户信息接收到Myth框架传入的信息=========="); final Boolean success = mythMqReceiveService.processMessage(message); if(success){ //消费成功,消息出队列,否则不消费 } }
-
<dependency> <groupId>com.github.myth</groupId> <artifactId>myth-dubbo</artifactId> </dependency>
-
配置 MythTransactionBootstrap启动类,可以采用xml方式,或者@Bean的方式,具体配置可以参考:配置详解
<context:component-scan base-package="com.github.myth.*"/> <aop:aspectj-autoproxy expose-proxy="true"/> <bean id="mythTransactionBootstrap" class="com.github.myth.core.bootstrap.MythTransactionBootstrap"> <property name="repositorySuffix" value="account-service"/> <property name="serializer" value="kryo"/> <property name="coordinatorQueueMax" value="5000"/> <property name="coordinatorThreadMax" value="8"/> <property name="rejectPolicy" value="Abort"/> <property name="blockingQueueType" value="Linked"/> <property name="needRecover" value="true"/> <property name="scheduledDelay" value="120"/> <property name="scheduledThreadMax" value="4"/> <property name="repositorySupport" value="db"/> <property name="mythDbConfig"> <bean class="com.github.myth.common.config.MythDbConfig"> <property name="url" value="jdbc:mysql://192.168.1.68:3306/myth?useUnicode=true&characterEncoding=utf8"/> <property name="driverClassName" value="com.mysql.jdbc.Driver"/> <property name="password" value="Wgj@555888"/> <property name="username" value="xiaoyu"/> </bean> </property> </bean>
-
<!-设置为true,表明采用恢复策略--> <property name="needRecover" value="true"/> <!--调度延迟时间--> <property name="scheduledDelay" value="120"/> <!--调度线程线程大小--> <property name="scheduledThreadMax" value="4"/>
-
<dependency> <groupId>com.github.myth</groupId> <artifactId>myth-jms</artifactId> </dependency>
<bean id="activemqSendService" class="com.github.myth.jms.service.ActivemqSendServiceImpl"> <property name="jmsTemplate" ref="jmsTemplate"/> </bean>
-
<dependency> <groupId>com.github.myth</groupId> <artifactId>myth-rabbitmq</artifactId> </dependency>
<bean id="rabbitmqSendService" class="com.github.myth.rabbitmq.service.RabbitmqSendServiceImpl"> <property name="amqpTemplate" ref="amqpTemplate"/> </bean>
-
<dependency> <groupId>com.github.myth</groupId> <artifactId>myth-kafka</artifactId> </dependency>
<bean id="KafkaSendService" class="com.github.myth.kafka.service.KafkaSendServiceImpl" > <property name="kafkaTemplate" ref="kafkaTemplate"/> </bean
-
<dependency> <groupId>com.github.myth</groupId> <artifactId>myth-rocketmq</artifactId> </dependency>
<bean id="rocketmqSendService" class="com.github.myth.rocketmq.service.RocketmqSendServiceImpl"> <property name="defaultMQProducer" ref="defaultMQProducer"/> </bean>