zongwei007 / jms-redis Goto Github PK
View Code? Open in Web Editor NEW基于 Redis、JMS 2.0 实现的消息服务
基于 Redis、JMS 2.0 实现的消息服务
JmsConsumerImpl.readMessage
/**
* 按消息 ID 读取消息体
*
* @param messageId 消息 ID
* @return JMS 消息
*/
private Message readMessage(String messageId) {
byte[] propsKey = getDestinationPropsKey(destination, messageId);
try (Jedis client = context.pool().getResource()) {
Map<String, byte[]> props = JmsMessageHelper.toStringKey(client.hgetAll(propsKey));
if (props == null || props.isEmpty() || props.size() == 0) { // 应加入此判断,避免"Unknown message type"
// 消息有可能已过期
return null;
}
// 省略...
}
您好,我在尝试使用您的程序,可是使用您在readme上写的使用方式后发生了异常,您可以帮我看一下是哪里错了吗?
redis-cil:
127.0.0.1:6379> MONITOR
OK
1619359494.759739 [0 127.0.0.1:54674] "MULTI"
1619359494.775513 [0 127.0.0.1:54674] "HMSET" "JMS:QUEUE:Queue:ID:otwvLbBmQXOaXCdrKxVkYA" "JMSTimestamp" "1619359494688" "JMSPriority" "0" "JMSDeliveryMode" "2" "JMSRedelivered" "false" "JMSDestination" "QUEUE:Queue" "JMSType" "Text"
1619359494.775622 [0 127.0.0.1:54674] "SET" "JMS:QUEUE:Queue:ID:otwvLbBmQXOaXCdrKxVkYA:BODY" "Queue Message"
1619359494.775650 [0 127.0.0.1:54674] "LPUSH" "JMS:QUEUE:Queue" "ID:otwvLbBmQXOaXCdrKxVkYA"
1619359494.775672 [0 127.0.0.1:54674] "CLIENT" "REPLY" "OFF"
1619359494.775685 [0 127.0.0.1:54674] "EXEC"
1619359494.775691 [0 127.0.0.1:54674] "CLIENT" "REPLY" "ON"
java异常:
Exception in thread "main" org.redisson.client.RedisException: ERR Syntax error, try CLIENT (LIST | KILL ip:port | GETNAME | SETNAME connection-name). channel: [id: 0x1916bf42, L:/127.0.0.1:54674 - R:127.0.0.1/127.0.0.1:6379] command: (EXEC), params: null
at org.redisson.client.handler.CommandDecoder.decode(CommandDecoder.java:355)
at org.redisson.client.handler.CommandDecoder.decodeList(CommandDecoder.java:405)
at org.redisson.client.handler.CommandDecoder.decode(CommandDecoder.java:377)
at org.redisson.client.handler.CommandDecoder.decodeCommandBatch(CommandDecoder.java:266)
at org.redisson.client.handler.CommandDecoder.decodeCommand(CommandDecoder.java:207)
at org.redisson.client.handler.CommandDecoder.decode(CommandDecoder.java:134)
at org.redisson.client.handler.CommandDecoder.decode(CommandDecoder.java:104)
at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:498)
at io.netty.handler.codec.ReplayingDecoder.callDecode(ReplayingDecoder.java:366)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:377)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:355)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:377)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:714)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.