修复:appname 名称丢失,rpc调用失败bug
This commit is contained in:
22
test/net.tccn/cache/RedisTest.java
vendored
22
test/net.tccn/cache/RedisTest.java
vendored
@@ -1,4 +1,4 @@
|
||||
package org.redkalex.cache.redis.test;
|
||||
package net.tccn.cache;
|
||||
|
||||
import org.redkale.net.AsyncIOGroup;
|
||||
import org.redkale.util.AnyValue;
|
||||
@@ -75,7 +75,7 @@ public class RedisTest {
|
||||
|
||||
//source.getexLong()
|
||||
|
||||
source.setHms("hmx", Map.of("a", "5","b", "51", "c", "ads"));
|
||||
source.setHms("hmx", Map.of("a", "5", "b", "51", "c", "ads"));
|
||||
|
||||
List<Serializable> hmget = source.hmget("hmx", int.class, "a");
|
||||
|
||||
@@ -85,7 +85,23 @@ public class RedisTest {
|
||||
System.out.println(hm);
|
||||
|
||||
Map<String, String> hms = source.getHms("hmx", "a", "b");
|
||||
System.out.println(hms);
|
||||
System.out.println("hmx:" + hms);
|
||||
|
||||
/*System.out.println("======================================================");
|
||||
System.out.println(source.incrHm("hmx", "a", -6.0));
|
||||
hms = source.getHms("hmx", "a", "b");
|
||||
System.out.println("hmx:a+1后的结果 " + hms);*/
|
||||
System.out.println("======================================================");
|
||||
source.setHm("hmx", "c", 12);
|
||||
hms = source.getHms("hmx", "a", "b", "c", "d", "a");
|
||||
System.out.println("hmx:设置 c=12 后的结果 " + hms);
|
||||
System.out.println("======================================================");
|
||||
Double c = source.getHm("hmx", double.class, "c");
|
||||
System.out.println("hmx 中 c 值:" + c);
|
||||
|
||||
/*Map<String, Object> hmx = source.getHmall("hmx");
|
||||
System.out.println("Hmall:" + hmx);*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -1,11 +1,8 @@
|
||||
package com.zdemo.test;
|
||||
package net.tccn.mq;
|
||||
|
||||
import com.zdemo.Event;
|
||||
import com.zdemo.IProducer;
|
||||
import com.zdemo.zhub.Delays;
|
||||
import net.tccn.Event;
|
||||
import net.tccn.timer.Timers;
|
||||
import org.junit.Test;
|
||||
import org.redkale.boot.Application;
|
||||
import org.redkale.convert.json.JsonConvert;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -33,13 +30,6 @@ public class AppTest {
|
||||
|
||||
System.out.println(str.length());
|
||||
|
||||
//启动并开启消费监听
|
||||
MyConsumer consumer = Application.singleton(MyConsumer.class);
|
||||
|
||||
consumer.subscribe("a", strx -> {
|
||||
logger.info("我收到了消息 a 事件:" + str);
|
||||
});
|
||||
|
||||
/*consumer.timer("a", () -> {
|
||||
System.out.println(Utility.now() + " timer a 执行了");
|
||||
try {
|
||||
@@ -83,20 +73,7 @@ public class AppTest {
|
||||
|
||||
@Test
|
||||
public void runProducer() {
|
||||
try {
|
||||
MyConsumer producer = Application.singleton(MyConsumer.class);
|
||||
for (int i = 0; i < 10_0000; i++) {
|
||||
producer.publish("a-1", i);
|
||||
}
|
||||
|
||||
try {
|
||||
Thread.sleep(1_000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private static LinkedBlockingQueue<String> queue = new LinkedBlockingQueue();
|
||||
@@ -148,21 +125,6 @@ public class AppTest {
|
||||
System.out.println(fun.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void yy() {
|
||||
IProducer producer = null;
|
||||
try {
|
||||
producer = Application.singleton(MyConsumer.class);
|
||||
|
||||
for (int i = 0; i < 100; i++) {
|
||||
|
||||
producer.publish("x", "x");
|
||||
Thread.sleep(1000);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
// (27+5*23)/(63-59)
|
||||
// [27+5*23] [/] [63-59]
|
||||
@@ -380,10 +342,10 @@ public class AppTest {
|
||||
|
||||
@Test
|
||||
public void delay() {
|
||||
DelayQueue<Delays> delayQueue = new DelayQueue<>();
|
||||
DelayQueue<com.zdemo.zhub.Delays> delayQueue = new DelayQueue<>();
|
||||
|
||||
logger.info("加入延时任务1");
|
||||
delayQueue.add(new Delays(5000, () -> {
|
||||
delayQueue.add(new com.zdemo.zhub.Delays(5000, () -> {
|
||||
logger.info("任务1 延时任务执行了!");
|
||||
}));
|
||||
|
||||
@@ -394,13 +356,13 @@ public class AppTest {
|
||||
}
|
||||
|
||||
logger.info("加入延时任务2");
|
||||
delayQueue.add(new Delays(5000, () -> {
|
||||
delayQueue.add(new com.zdemo.zhub.Delays(5000, () -> {
|
||||
logger.info("任务2 延时任务执行了!");
|
||||
}));
|
||||
|
||||
try {
|
||||
while (true) {
|
||||
Delays delay = delayQueue.take();
|
||||
com.zdemo.zhub.Delays delay = delayQueue.take();
|
||||
|
||||
delay.run();
|
||||
}
|
||||
|
@@ -1,9 +1,8 @@
|
||||
package com.zdemo.test;
|
||||
package net.tccn.mq;
|
||||
|
||||
import com.zdemo.IType;
|
||||
import com.zdemo.ZhubProvider;
|
||||
import com.zdemo.zhub.RpcResult;
|
||||
import com.zdemo.zhub.ZHubClient;
|
||||
import net.tccn.IType;
|
||||
import net.tccn.zhub.RpcResult;
|
||||
import net.tccn.zhub.ZHubClient;
|
||||
import org.redkale.net.http.RestMapping;
|
||||
import org.redkale.net.http.RestService;
|
||||
import org.redkale.service.Service;
|
||||
@@ -48,7 +47,7 @@ public class HelloService implements Service {
|
||||
zhub.rpcSubscribe("y", new TypeToken<String>() {
|
||||
}, r -> {
|
||||
|
||||
return r.buildResp(Map.of("v", r.getValue().toUpperCase() + ": Ok"));
|
||||
return r.render(Map.of("v", r.getValue().toUpperCase() + ": Ok"));
|
||||
});
|
||||
|
||||
zhub.subscribe("sport:reqtime", x -> {
|
||||
|
@@ -1,15 +0,0 @@
|
||||
package com.zdemo.test;
|
||||
|
||||
import com.zdemo.zhub.ZHubClient;
|
||||
|
||||
public class MyConsumer extends ZHubClient {
|
||||
|
||||
public String getGroupid() {
|
||||
return "group-test"; //消费组名称
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean preInit() {
|
||||
return true;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user