Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/redis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Caching Mule 4-将Redis连接器用作自定义对象存储“连接不再有效”_Caching_Redis_Mule - Fatal编程技术网

Caching Mule 4-将Redis连接器用作自定义对象存储“连接不再有效”

Caching Mule 4-将Redis连接器用作自定义对象存储“连接不再有效”,caching,redis,mule,Caching,Redis,Mule,我正在尝试使用Redis作为Mule 4项目的对象存储的后端。我已经按照说明进行了操作,但是在项目启动时,我不断遇到一个错误: 原因:reactor.core.Exceptions$ReactiveException:org.mule.runtime.api.exception.DefaultMuleException:从ObjectStore配置“ObjectStore\u配置”获得无效连接。 错误类型:未知。 消息:连接不再有效 以下是我的配置的截断视图: <mule xmlns:re

我正在尝试使用Redis作为Mule 4项目的对象存储的后端。我已经按照说明进行了操作,但是在项目启动时,我不断遇到一个错误:

原因:reactor.core.Exceptions$ReactiveException:org.mule.runtime.api.exception.DefaultMuleException:从ObjectStore配置“ObjectStore\u配置”获得无效连接。 错误类型:未知。 消息:连接不再有效

以下是我的配置的截断视图:

<mule xmlns:redis="http://www.mulesoft.org/schema/mule/redis"
    xmlns:os="http://www.mulesoft.org/schema/mule/os"
    xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core"
    xmlns:apikit="http://www.mulesoft.org/schema/mule/mule-apikit" xmlns:http="http://www.mulesoft.org/schema/mule/http"
    xmlns="http://www.mulesoft.org/schema/mule/core"
    xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd 
http://www.mulesoft.org/schema/mule/mule-apikit http://www.mulesoft.org/schema/mule/mule-apikit/current/mule-apikit.xsd 
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/os http://www.mulesoft.org/schema/mule/os/current/mule-os.xsd
http://www.mulesoft.org/schema/mule/redis http://www.mulesoft.org/schema/mule/redis/current/mule-redis.xsd">    

  ...

  <os:config name="ObjectStore_Config" doc:name="ObjectStore Config" doc:id="627a35b0-4b36-45e2-8ff6-fdd0eb9cb067">
    <redis:nonclustered-connection host="http://localhost:6379" />
  </os:config>

  <os:object-store name="Object_store" 
    config-ref="ObjectStore_Config"
    maxEntries="1"
    entryTtl="60"
    expirationInterval="10"
    expirationIntervalUnit="SECONDS"
    doc:name="Object store" 
    doc:id="bef9d4d3-0441-477c-a8b1-46626c95c9de" />  

  ...
</mule>
我在另一个项目中验证了我可以使用redis连接器连接到此实例并获取/设置数据


为什么此连接不再适用于ObjectStore配置?

我将我的项目与mule support提供的示例项目进行了比较,发现我需要添加元素,并将os:config中嵌套的redis:nonclustered连接上的主机属性拆分为主机和端口:

$ docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                    NAMES
126faa8c33a7        redis:3.2.12        "docker-entrypoint.s…"   5 days ago          Up 5 days           0.0.0.0:6379->6379/tcp   redis
<os:config name="ObjectStore_Config">
  <redis:nonclustered-connection host="localhost" port="6379"/>
</os:config>

<redis:redis-config name="Redis_Redis" doc:name="Redis Redis" >
  <redis:nonclustered-connection />
</redis:redis-config>