我正在尝试实现mule publish-subscribe模块。我收到了以下错误:
cvc-complex-type.2.4.a: Invalid content was found starting with element 'pubsub:config'. One of '{"http://www.mulesoft.org/schema/mule/core":annotations, "http://www.mulesoft.org/schema/mule/core":description, "http://www.springframework.org/schema/beans":beans, "http://www.springframework.org/schema/beans":bean, "http://www.springframework.org/schema/context":property-placeholder, "http://www.springframework.org/schema/beans":ref, "http://www.mulesoft.org/schema/mule/core":global-property, "http://www.mulesoft.org/schema/mule/core":configuration, "http://www.mulesoft.org/schema/mule/core":notifications, "http://www.mulesoft.org/schema/mule/core":abstract-extension, "http://www.mulesoft.org/schema/mule/core":abstract-mixed-content-extension, "http://www.mulesoft.org/schema/mule/core":abstract-agent, "http://www.mulesoft.org/schema/mule/core":abstract-security-manager, "http://www.mulesoft.org/schema/mule/core":abstract-transaction-manager, "http://www.mulesoft.org/schema/mule/core":abstract-connector, "http://www.mulesoft.org/schema/mule/core":abstract-global-endpoint, "http://www.mulesoft.org/schema/mule/core":abstract-exception-strategy, "http://www.mulesoft.org/schema/mule/core":abstract-flow-construct, "http://www.mulesoft.org/schema/mule/core":flow, "http://www.mulesoft.org/schema/mule/core":sub-flow, "http://www.mulesoft.org/schema/mule/core":abstract-model, "http://www.mulesoft.org/schema/mule/core":abstract-interceptor-stack, "http://www.mulesoft.org/schema/mule/core":abstract-filter, "http://www.mulesoft.org/schema/mule/core":abstract-transformer, "http://www.mulesoft.org/schema/mule/core":processor-chain, "http://www.mulesoft.org/schema/mule/core":custom-processor, "http://www.mulesoft.org/schema/mule/core":invoke, "http://www.mulesoft.org/schema/mule/core":abstract-global-intercepting-message-processor, "http://www.mulesoft.org/schema/mule/core":custom-queue-store, "http://www.mulesoft.org/schema/mule/core":abstract-processing-strategy}' is expected.
看起来,它抱怨元素
我的代码:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:vm="http://www.mulesoft.org/schema/mule/vm"
xmlns:pubsub="http://www.mulesoft.org/schema/mule/pubsub"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/current/mule-vm.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/pubsub http://www.mulesoft.org/schema/mule/pubsub/current/mule-pubsub.xsd">
<pubsub:config name="my-config"/>
<flow name="testListenerTopicA">
<pubsub:listener config-ref="my-config" topic="topic-A"/>
<logger level="INFO" message="Received an event for topic A with payload #[payload]"/>
</flow>
<flow name="testListenerTopicB">
<logger level="INFO" message="Received an event for topic B with payload #[payload]"/>
</flow>
<flow name="testPublisherTopicA">
<pubsub:publish config-ref="my-config" topic="topic-A"/>
</flow>
<flow name="testPublisherTopicB">
<pubsub:publish config-ref="my-config" topic="topic-B"/>
</flow>
<flow name="testSubscribeTopicB">
<pubsub:subscribe config-ref="my-config" topic="topic-B" subscriberId="123" flow-ref="testListenerTopicB"/>
</flow>
<flow name="testUnsubscribeTopicB">
<pubsub:unsubscribe config-ref="my-config" topic="topic-B" subscriberId="123"/>
</flow>
</mule>
我将不胜感激。
答案 0 :(得分:0)
可能您没有将模块添加到项目中。它没有添加到内部版本中,因此Mule找不到元素的定义。