加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

BlazeDS不同方式......

发布时间:2020-12-15 05:15:03 所属栏目:百科 来源:网络整理
导读:If you work with LCDS or BlazeDS and are about to configure a second web application inside the same EAR,then you might see an error like this when the application starts up: javax.servlet.UnavailableException: MessageBroker already define
If you work with LCDS or BlazeDS and are about to configure a second web application inside the same EAR,then you might see an error like this when the application starts up:
javax.servlet.UnavailableException: MessageBroker already defined from MessageBrokerServlet with init parameter messageBrokerId = '__default__'

<servlet>
<servlet-name>MessageBrokerServlet</servlet-name>
<display-name>MessageBrokerServlet</display-name>
<servlet-class>flex.messaging.MessageBrokerServlet</servlet-class>
<init-param>
<param-name>services.configuration.file</param-name>
<param-value>/WEB-INF/flex/services-config.xml</param-value>
</init-param>
<init-param>
<param-name>flex.write.path</param-name>
<param-value>/WEB-INF/flex</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
The above declaration is the default,and when both servlets are initialized,both are given a default identifier of '__default__'.

<init-param>
<param-name>messageBrokerId</param-name>
<param-value>55</param-value>
</init-param>

message-broker:

1)<flex:message-broker/>
2)<flex:message-broker services-config-path="classpath*:services-config.xml">
3)<bean id="_messageBroker" class="org.springframework.flex.core.MessageBrokerFactoryBean" >
?? ?<property name="servicesConfigPath" value="classpath*:services-config.xml" />
</bean>

<flex:message-broker>
??? <flex:mapping pattern="/messagebroker/*" />
??? <flex:config-processor ref="myConfigProcessor" />
??? <flex:exception-translator ref="myExceptionTranslator"/>
??? <flex:message-interceptor ref="myMessageInterceptor"/>
??? flex:remoting-service default-adapter-id="hibernate-object" default-channels="my-amf,my-secure-amf"/>
</flex:message-broker>


DestinationExporter:

1)<bean id="productService" class="flex.samples.product.ProductServiceImpl" > ?? ?<flex:remoting-destination /> </bean> 2)<bean id="product" class="org.springframework.flex.remoting.RemotingDestinationExporter"> ??? <property name="messageBroker" ref="_messageBroker"/> ??? <property name="service" ref="productService"/> ??? <property name="destinationId" value="productService"/> ??? <property name="includeMethods" value="read,update"/> ??? <property name="excludeMethods" value="create,delete"/> ??? <property name="channels" value="my-amf,my-secure-amf"/> </bean> ?? ? package com.example; import org.springframework.flex.config.MessageBrokerConfigProcessor; import flex.messaging.MessageBroker; import flex.messaging.services.RemotingService; public class MyDestinationCountingConfigProcessor implements MessageBrokerConfigProcessor { ?? ?public MessageBroker processAfterStartup(MessageBroker broker) { ?? ??? ?RemotingService remotingService = ?? ??? ??? ?(RemotingService) broker.getServiceByType(RemotingService.class.getName()); ?? ??? ?if (remotingService.isStarted()) { ?? ??? ??? ?System.out.println("The Remoting Service has been started with " ?? ??? ??? ??? ??? ?+remotingService.getDestinations().size()+" Destinations."); ?? ??? ?} ?? ??? ?return broker; ?? ?} ?? ?public MessageBroker processBeforeStartup(MessageBroker broker) { ?? ??? ?return broker; ?? ?} }

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读