java—使用jedis消息代理订阅端口时拒绝连接

uqdfh47h  于 2021-06-10  发布在  Redis
关注(0)|答案(0)|浏览(238)

我一直在尝试在本地主机上使用redis的messagebroker订阅端口。我用的是绝地api。
当我尝试连接时,我不断地得到错误 connection refused . 我尝试了5个应该是免费的端口,并尝试使用“localhost”和“0.0.0.0”作为主机名。
这就是我所尝试的:

private static final int PORT = 25564;
private static final String HOST = "0.0.0.0";

private Jedis jedis = new Jedis(HOST,PORT);

private JedisPubSub arenaEventHandler = new JedisPubSub() {
     @Override
     public void onMessage(String channel, String message) {
         getLogger().info("received message on " + channel + ": " + message);
     }
};

private void setupArenaSubscription(){
    getProxy().getScheduler().runAsync(this, () -> {
        try {
            jedis.psubscribe(arenaEventHandler, "ARENA*");
            getLogger().info("Subscription ended.");
        } catch (Exception e) {
            getLogger().log(Level.SEVERE,"Subscribing failed.", e);
        }
    });
}

如您所见,我也在使用bungeecordapi,但这不应该影响连接。
调用时,try catch块中发生错误 pSubscribe . 我希望任何人都能帮助我解决这个问题。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题