yunhao.wang 7 years ago
commit baee2c5f93

@ -21,11 +21,9 @@
<groupId>i3plus.pojo</groupId> <groupId>i3plus.pojo</groupId>
<artifactId>i3plus-pojo-mes</artifactId> <artifactId>i3plus-pojo-mes</artifactId>
</dependency> </dependency>
<!-- shiro -->
<dependency> <dependency>
<groupId>org.apache.shiro</groupId> <groupId>i3plus.pojo</groupId>
<artifactId>shiro-core</artifactId> <artifactId>i3plus-pojo-wms</artifactId>
</dependency> </dependency>
</dependencies> </dependencies>

@ -1,7 +1,6 @@
package cn.estsh.i3plus.core.api.iservice.busi; package cn.estsh.i3plus.core.api.iservice.busi;
import cn.estsh.i3plus.pojo.platform.bean.LogOperate; import cn.estsh.i3plus.pojo.platform.bean.LogOperate;
import cn.estsh.i3plus.pojo.platform.bean.LogOperate;
import java.util.List; import java.util.List;

@ -23,7 +23,10 @@
<groupId>i3plus.pojo</groupId> <groupId>i3plus.pojo</groupId>
<artifactId>i3plus-pojo-base</artifactId> <artifactId>i3plus-pojo-base</artifactId>
</dependency> </dependency>
<dependency>
<groupId>i3plus.pojo</groupId>
<artifactId>i3plus-pojo-wms</artifactId>
</dependency>
<!-- api调用 --> <!-- api调用 -->
<dependency> <dependency>
@ -57,43 +60,11 @@
<artifactId>commons-lang3</artifactId> <artifactId>commons-lang3</artifactId>
</dependency> </dependency>
<!-- shiro -->
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-spring</artifactId>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-web</artifactId>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-ehcache</artifactId>
</dependency>
<!-- fastjson --> <!-- fastjson -->
<dependency> <dependency>
<groupId>com.alibaba</groupId> <groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId> <artifactId>fastjson</artifactId>
</dependency> </dependency>
<!-- ehcache缓存 -->
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache-core</artifactId>
</dependency>
<dependency>
<groupId>i3plus.pojo</groupId>
<artifactId>i3plus-pojo-mes</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
</dependencies> </dependencies>
<build> <build>

@ -17,43 +17,48 @@ import org.springframework.context.annotation.Configuration;
public class I3CoreQueueConfig { public class I3CoreQueueConfig {
private static final Logger LOGGER = LoggerFactory.getLogger(I3CoreQueueConfig.class); private static final Logger LOGGER = LoggerFactory.getLogger(I3CoreQueueConfig.class);
public static final String DEMO_STR_QUEUE = "demo_str_queue"; public static final String IMPP_MESSAGE_QUEUE = "IMPP_MESSAGE_QUEUE";
@Bean
public static final String DEMO_OBJ_QUEUE = "demo_obj_queue"; public Queue getImppMessageQueue() {
LOGGER.info("【开启平台消息队列】");
return new Queue(IMPP_MESSAGE_QUEUE);
}
public static final String DEMO_HANDLE_QUEUE = "demo_handle_queue";
public static final String DEMO_ACK_QUEUE = "ack_queue"; /*********** 队列demo ***********/
public static final String DEMO_RETURN_QUEUE = "return_queue";
public static final String DEMO_STR_QUEUE = "demo_str_queue";
@Bean @Bean
public Queue getStrQueue() { public Queue getStrQueue() {
//LOGGER.info("【DEMO_STR_QUEUE队列】"); //LOGGER.info("【DEMO_STR_QUEUE队列】");
return new Queue(DEMO_STR_QUEUE); return new Queue(DEMO_STR_QUEUE);
} }
public static final String DEMO_OBJ_QUEUE = "demo_obj_queue";
@Bean @Bean
public Queue getObjQueue() throws Exception { public Queue getObjQueue() throws Exception {
//LOGGER.info("【DEMO_OBJ_QUEUE队列】"); //LOGGER.info("【DEMO_OBJ_QUEUE队列】");
return new Queue(DEMO_OBJ_QUEUE); return new Queue(DEMO_OBJ_QUEUE);
} }
public static final String DEMO_HANDLE_QUEUE = "demo_handle_queue";
@Bean @Bean
public Queue getHandleQueue() throws Exception { public Queue getHandleQueue() throws Exception {
//LOGGER.info("【DEMO_HANDLE_QUEUE队列】"); //LOGGER.info("【DEMO_HANDLE_QUEUE队列】");
return new Queue(DEMO_HANDLE_QUEUE); return new Queue(DEMO_HANDLE_QUEUE);
} }
@Bean public static final String DEMO_ACK_QUEUE = "ack_queue";
public Queue getReturnQueue() throws Exception {
//LOGGER.info("【DEMO_RETURN_QUEUE队列】");
return new Queue(DEMO_RETURN_QUEUE);
}
@Bean @Bean
public Queue getAckQueue() throws Exception { public Queue getAckQueue() throws Exception {
LOGGER.info("【DEMO_ACK_QUEUE队列】"); LOGGER.info("【DEMO_ACK_QUEUE队列】");
return new Queue(DEMO_ACK_QUEUE); return new Queue(DEMO_ACK_QUEUE);
} }
public static final String DEMO_RETURN_QUEUE = "return_queue";
@Bean
public Queue getReturnQueue() throws Exception {
//LOGGER.info("【DEMO_RETURN_QUEUE队列】");
return new Queue(DEMO_RETURN_QUEUE);
}
} }

@ -1,6 +1,10 @@
package cn.estsh.i3plus.core.apiservice.mq; package cn.estsh.i3plus.core.apiservice.mq;
import cn.estsh.i3plus.core.apiservice.controller.DemoRestController;
import cn.estsh.i3plus.pojo.platform.bean.SysMessage;
import com.rabbitmq.client.Channel; import com.rabbitmq.client.Channel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.Message; import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener; import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -16,6 +20,36 @@ import java.io.IOException;
**/ **/
@Component @Component
public class I3CoreQueueReceiver { public class I3CoreQueueReceiver {
private static final Logger LOGGER = LoggerFactory.getLogger(I3CoreQueueReceiver.class);
/**
*
* @param msg
* @param channel
* @param message
* rabbitTemplate.convertAndSend(I3CoreQueueConfig.IMPP_MESSAGE_QUEUE, new SysMessage(....));
*/
@RabbitListener(queues = I3CoreQueueConfig.IMPP_MESSAGE_QUEUE)
public void processImppMessage(SysMessage msg, Channel channel, Message message) {
try {
LOGGER.info("【MQ-IMPP_MESSAGE_QUEUE】数据接收成功{}",msg);
//信息已处理
channel.basicAck(message.getMessageProperties().getDeliveryTag(),false);
} catch (IOException e) {
LOGGER.error("【MQ-IMPP_MESSAGE_QUEUE】处理出错{}",e.getMessage(),e);
//丢弃这条消息
try {
// 未成功处理,重新发送
channel.basicNack(message.getMessageProperties().getDeliveryTag(),false,true);
} catch (IOException e1) {
e1.printStackTrace();
}
}
}
/********************* 消息队列处理demo *******************/
/*@RabbitListener(queues = I3CoreQueueConfig.DEMO_STR_QUEUE) /*@RabbitListener(queues = I3CoreQueueConfig.DEMO_STR_QUEUE)
public void getObjQueue(String data) { public void getObjQueue(String data) {
@ -71,10 +105,12 @@ public class I3CoreQueueReceiver {
//在队列删掉 不会再发了 否则消息服务器以为这条消息没处理掉 后续还会在发 //在队列删掉 不会再发了 否则消息服务器以为这条消息没处理掉 后续还会在发
channel.basicAck(message.getMessageProperties().getDeliveryTag(),false); channel.basicAck(message.getMessageProperties().getDeliveryTag(),false);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); //丢弃这条消息 e.printStackTrace();
//丢弃这条消息
// channel.basicNack(message.getMessageProperties().getDeliveryTag(), false,false); // channel.basicNack(message.getMessageProperties().getDeliveryTag(), false,false);
// System.out.println("receiver fail"); // System.out.println("receiver fail");
try { try {
//
channel.basicNack(message.getMessageProperties().getDeliveryTag(),false,true); channel.basicNack(message.getMessageProperties().getDeliveryTag(),false,true);
} catch (IOException e1) { } catch (IOException e1) {
e1.printStackTrace(); e1.printStackTrace();

@ -14,8 +14,6 @@ filter.shiro.saadmin.filteruri = /saoperate/*
#是否允许前端跨域提交 #是否允许前端跨域提交
impp.web.cross = true impp.web.cross = true
#允许前端跨域提交ip地址多个以逗号分隔
impp.web.cross.hosts = http://127.0.0.1,http://localhost
################ 主数据源 ################ ################ 主数据源 ################
# mysql # mysql

@ -44,12 +44,6 @@
</properties> </properties>
<dependencies> <dependencies>
<!-- 外部对象模型 -->
<dependency>
<groupId>i3plus.pojo</groupId>
<artifactId>i3plus-pojo-wms</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies> </dependencies>
<dependencyManagement> <dependencyManagement>
@ -63,6 +57,12 @@
<dependency> <dependency>
<groupId>i3plus.pojo</groupId> <groupId>i3plus.pojo</groupId>
<artifactId>i3plus-pojo-base</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>i3plus.pojo</groupId>
<artifactId>i3plus-pojo-model</artifactId> <artifactId>i3plus-pojo-model</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
@ -97,7 +97,7 @@
<dependency> <dependency>
<groupId>i3plus.pojo</groupId> <groupId>i3plus.pojo</groupId>
<artifactId>i3plus-pojo-mes</artifactId> <artifactId>i3plus-pojo-wms</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
@ -115,28 +115,6 @@
<version>3.8.1</version> <version>3.8.1</version>
</dependency> </dependency>
<!-- shiro -->
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-core</artifactId>
<version>1.4.0</version>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-web</artifactId>
<version>1.4.0</version>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-spring</artifactId>
<version>1.4.0</version>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-ehcache</artifactId>
<version>1.4.0</version>
</dependency>
<!-- json --> <!-- json -->
<dependency> <dependency>
<groupId>com.alibaba</groupId> <groupId>com.alibaba</groupId>
@ -153,9 +131,6 @@
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
<!-- 私有仓库引用配置 --> <!-- 私有仓库引用配置 -->
<repositories> <repositories>
<repository> <repository>
@ -180,9 +155,6 @@
</snapshotRepository> </snapshotRepository>
</distributionManagement> </distributionManagement>
<build> <build>
<plugins> <plugins>
<!-- maven编译的一些插件 --> <!-- maven编译的一些插件 -->
@ -216,7 +188,7 @@
<configuration> <configuration>
<releaseProfiles>prod</releaseProfiles> <releaseProfiles>prod</releaseProfiles>
<autoVersionSubmodules>true</autoVersionSubmodules> <autoVersionSubmodules>true</autoVersionSubmodules>
<tagBase>http://git.evun.cn/GCDC-MES-SERVICE/PLATFORM_PROD_EXEC.git</tagBase> <tagBase>http://git.estsh.com/i3-IMPP/i3plus-core.git</tagBase>
<tagNameFormat>v@{project.version}</tagNameFormat> <tagNameFormat>v@{project.version}</tagNameFormat>
</configuration> </configuration>
</plugin> </plugin>

Loading…
Cancel
Save