正在显示
3 个修改的文件
包含
29 行增加
和
22 行删除
@@ -8,6 +8,7 @@ package com.airport; | @@ -8,6 +8,7 @@ package com.airport; | ||
8 | import com.airport.core.AgentSender; | 8 | import com.airport.core.AgentSender; |
9 | import com.airport.core.IMFNoDelaySender; | 9 | import com.airport.core.IMFNoDelaySender; |
10 | import com.airport.core.IMFReader; | 10 | import com.airport.core.IMFReader; |
11 | +import com.airport.core.ZYFNoDelaySender; | ||
11 | import com.airport.util.ConfigUtils; | 12 | import com.airport.util.ConfigUtils; |
12 | import com.airport.util.SystemBean; | 13 | import com.airport.util.SystemBean; |
13 | import com.caac.imf.api.IMFClient; | 14 | import com.caac.imf.api.IMFClient; |
@@ -46,17 +47,17 @@ public class Main { | @@ -46,17 +47,17 @@ public class Main { | ||
46 | logger.info("start run Timer,client hasocde=" + client.hashCode()); | 47 | logger.info("start run Timer,client hasocde=" + client.hashCode()); |
47 | 48 | ||
48 | //代理人发送程序 | 49 | //代理人发送程序 |
49 | -// AgentSender send = new AgentSender(client); | ||
50 | -// send.start(); | 50 | + AgentSender send = new AgentSender(client); |
51 | + send.start(); | ||
51 | 52 | ||
52 | //数据仓库给九州的发送程序 | 53 | //数据仓库给九州的发送程序 |
53 | - Timer timer = new Timer(); | 54 | +// Timer timer = new Timer(); |
54 | 55 | ||
55 | - //从配置文件读取sql语句,发送货运数据 | ||
56 | - String sql_select=ConfigUtils.SQl; | ||
57 | - String sqlmax = ConfigUtils.SQlMax; | ||
58 | - IMFNoDelaySender CangKu2Jiuzhou = new IMFNoDelaySender(client,"data/fid_index.txt",sql_select,sqlmax); | ||
59 | - CangKu2Jiuzhou.start(); | 56 | +// //从配置文件读取sql语句,发送货运数据 |
57 | +// String sql_select=ConfigUtils.SQl; | ||
58 | +// String sqlmax = ConfigUtils.SQlMax; | ||
59 | +// ZYFNoDelaySender CangKu2Jiuzhou = new ZYFNoDelaySender(client,"data/fid_index.txt",sql_select,sqlmax); | ||
60 | +// CangKu2Jiuzhou.start(); | ||
60 | // timer.schedule(CangKu2Jiuzhou, 10000L, 1200000L); | 61 | // timer.schedule(CangKu2Jiuzhou, 10000L, 1200000L); |
61 | 62 | ||
62 | } | 63 | } |
@@ -34,22 +34,28 @@ public class AgentSender extends Thread{ | @@ -34,22 +34,28 @@ public class AgentSender extends Thread{ | ||
34 | if(Main.isSuc){ | 34 | if(Main.isSuc){ |
35 | if(Main.LOGIN_OK){ | 35 | if(Main.LOGIN_OK){ |
36 | String SendMsg = jedis.rpoplpush("task-queue", "tmp-queue"); //取队列消息 | 36 | String SendMsg = jedis.rpoplpush("task-queue", "tmp-queue"); //取队列消息 |
37 | + logger.info("队列消息为:》》》"+SendMsg); | ||
37 | 38 | ||
38 | //9是发送成功 | 39 | //9是发送成功 |
39 | if(SendMsg !=null){ | 40 | if(SendMsg !=null){ |
40 | - logger.debug("<<发送的报文内容为:"+SendMsg+">>"); | ||
41 | - | ||
42 | - String returnMsg = client.sendMSG(SendMsg); | ||
43 | - logger.debug("<<发送返回的信息:"+returnMsg+">>"); | ||
44 | - | ||
45 | - if(returnMsg.indexOf("<CODE>9</CODE>")>=0){ | ||
46 | - jedis.rpop("tmp-queue"); | ||
47 | - logger.debug("<<移除队列>>"); | ||
48 | - }else{ | ||
49 | - //如果发送不成功继续发送 | ||
50 | - jedis.rpoplpush("tmp-queue", "task-queue"); | ||
51 | - logger.info("!!<<执行未成功发送的消息返回到发送消息队列>>!!"); | 41 | + |
42 | + try{ | ||
43 | + String returnMsg = client.sendMSG(SendMsg); | ||
44 | + logger.debug("<<发送返回的信息:"+returnMsg+">>"); | ||
45 | + | ||
46 | + if(returnMsg.indexOf("<CODE>9</CODE>")>=0){ | ||
47 | + jedis.rpop("tmp-queue"); | ||
48 | + logger.debug("<<移除队列>>"); | ||
49 | + }else{ | ||
50 | + //如果发送不成功继续发送 | ||
51 | + jedis.rpoplpush("tmp-queue", "task-queue"); | ||
52 | + logger.info("!!<<执行未成功发送的消息返回到发送消息队列>>!!"); | ||
53 | + } | ||
54 | + }catch (Exception e){ | ||
55 | + e.printStackTrace(); | ||
56 | + logger.info("!!<<请注意!发送异常====>>!!"); | ||
52 | } | 57 | } |
58 | + | ||
53 | } | 59 | } |
54 | 60 | ||
55 | }else{ | 61 | }else{ |
@@ -57,7 +63,7 @@ public class AgentSender extends Thread{ | @@ -57,7 +63,7 @@ public class AgentSender extends Thread{ | ||
57 | } | 63 | } |
58 | 64 | ||
59 | try { | 65 | try { |
60 | - Thread.sleep(5000); | 66 | + Thread.sleep(500);//发送延迟 |
61 | } catch (Exception e) { | 67 | } catch (Exception e) { |
62 | e.printStackTrace(); | 68 | e.printStackTrace(); |
63 | } | 69 | } |
@@ -40,7 +40,7 @@ public class DaoImpl implements Dao { | @@ -40,7 +40,7 @@ public class DaoImpl implements Dao { | ||
40 | this.jdbcTemplate = jdbcTemplate; | 40 | this.jdbcTemplate = jdbcTemplate; |
41 | } | 41 | } |
42 | 42 | ||
43 | - public int insertRecord(final String oper, final String sndr,String sntm,String type,String styp,String seqn) { | 43 | + public int insertRecord(final String oper, final String sndr,final String sntm,final String type,final String styp,final String seqn) { |
44 | KeyHolder keyHolder = new GeneratedKeyHolder(); | 44 | KeyHolder keyHolder = new GeneratedKeyHolder(); |
45 | this.jdbcTemplate.update(new PreparedStatementCreator() { | 45 | this.jdbcTemplate.update(new PreparedStatementCreator() { |
46 | public PreparedStatement createPreparedStatement(Connection connection) throws SQLException { | 46 | public PreparedStatement createPreparedStatement(Connection connection) throws SQLException { |
-
请 注册 或 登录 后发表评论