Browse Source

将push服务连接上eureka

wanghaicheng 5 years ago
parent
commit
5ffc2c27a0

+ 4 - 1
lift-push/pom.xml

@@ -35,7 +35,10 @@
             <groupId>cn.com.xwy</groupId>
             <artifactId>xwy-spring-boot</artifactId>
         </dependency>
-
+        <dependency>
+            <groupId>cn.com.xwy</groupId>
+            <artifactId>xwy-cloud-dependencies</artifactId>
+        </dependency>
     </dependencies>
 
     <build>

+ 1 - 1
lift-push/src/main/resources/application.yml

@@ -5,7 +5,7 @@ spring:
   application:
     name: lift-push-service
   profiles:
-    active: test
+    active: prod
   datasource:
     hikari:
       max-lifetime: 1200000 # default: 1800000

+ 23 - 0
lift-push/src/main/resources/bootstrap.yml

@@ -0,0 +1,23 @@
+spring:
+  cloud:
+    config:
+      fail-fast: true
+      discovery:
+        service-id: lift-config-server
+        enabled: true
+      name: portal
+      profile: ${spring.profiles.active}
+      failFast: true
+      retry:
+        multipliter: 1000
+        initial-interval: 1.2
+        max-interval: 2000
+        max-attempts: 6
+eureka:
+  instance:
+    prefer-ip-address: true
+    lease-renewal-interval-in-seconds: 5
+    lease-expiration-duration-in-seconds: 20
+  client:
+    service-url:
+      defaultZone: http://172.16.24.142:10225/eureka/

+ 1 - 1
lift-quan-service/src/main/java/cn/com/ty/lift/quan/news/service/impl/QuanNewsServiceImpl.java

@@ -58,7 +58,7 @@ public class QuanNewsServiceImpl extends ServiceImpl<QuanNewsMapper, QuanNews> i
         result.put("news", news);
         if (request.getHaveTops() == 1) {
             List<QuanNews> topNews = this.list(Wrappers.<QuanNews>query()
-                    .ne("is_top", true)
+                    .eq("is_top", true)
                     .orderByAsc("top_serial"));
             //把点赞的用户数量和浏览量整入新闻字段中
             newsAddLookAndLike(topNews, lookTimes, likeUsers);

+ 23 - 0
lift-quan-service/src/main/resources/application-prod.yml

@@ -18,6 +18,29 @@ spring:
         max-wait: 20000ms
         min-idle: 0
     timeout: 600000
+      # activeMQ 移动端消息推送配置
+  activemq:
+    #ActiveMQ通讯地址
+    broker-url: tcp://121.40.209.47:61616
+    #用户名
+    user: admin
+    #密码
+    password: admin
+    #true 表示使用内置的MQ,false则连接服务器: 消息持久化就必须spring.activemq.in-memory=false选项
+    in-memory: false
+    packages:
+      #信任所有的包: 如果直接发送对象消息,那么必须设置spring.activemq.packages.trust-all为true
+      trust-all: true
+    pool:
+      #true表示使用连接池;false时,每发送一条数据创建一个连接
+      enabled: true
+      #连接池最大连接数
+      max-connections: 30
+      #空闲的连接过期时间,默认为30秒
+      idle-timeout: 3000s
+  jms:
+    #如果是点对点(queue),那么此处默认应该是false,如果发布订阅,那么一定设置为true
+    pub-sub-domain: false
 
 #aliyun OSS服务配置信息,加载到SystemConfiguration
 aliyun: