directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kaspar Luethi <kas...@humantools.ch>
Subject Re: MINA FactoryBeans
Date Wed, 21 Dec 2005 14:07:49 GMT
hello Ither Seed

>Hi, people. I'm trying to use the FactoryBeans of MINA 0.9.0. I read
>the javadoc in the SocketAcceptorFactoryBean class and I successfully
>create a SocketAcceptor using it but I don't know how to make it wait
>for connections. All the examples use the ServiceRegistry interface
>for this. am I missing something? Thanks in advance.

have a look at the config below, works for me.
maybe you left out the "bindings"-part? show me your xml :)

the logging-filter is unused in this config, you could activate it this way:

      <property name="filters">
        <list>
          <ref local="threadPoolFilter"/>
          <ref local="loggingFilter"/>
        </list>
      </property>


by the way:
niklas, there are some typos in the javadocs, wrong class names
(i.e. org.apache.mina.spring.integration.Binding).
i like the spring integration, thanks.

kaspar


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" 
"http://www.springframework.org/dtd/spring-beans.dtd">
<beans>

    <!-- Shockwave IoHandler implementation -->
    <bean id="smusHandler" 
class="ch.shinypixel.server.ShockwaveProtocolHandler"/>

    <!-- AdminProtocol IoHandler implementation -->
    <bean id="adminHandler" class="ch.shinypixel.server.AdminProtocolHandler"/>

    <!-- Create a thread pool filter -->
    <bean id="threadPoolFilter"
          class="org.apache.mina.filter.ThreadPoolFilter">
      <!-- Threads will be named IoWorker-1, IoWorker-2, etc -->
      <constructor-arg value="IoWorker"/>
      <property name="maximumPoolSize" value="4"/>
    </bean>

    <!-- Create logging filter -->
    <bean id="loggingFilter" class="org.apache.mina.filter.LoggingFilter">
    </bean>

    <!-- Create the SocketAcceptor -->
    <bean id="socketAcceptor"
         class="org.apache.mina.integration.spring.SocketAcceptorFactoryBean">
      <property name="filters">
        <list>
          <ref local="threadPoolFilter"/>
        </list>
      </property>
      <property name="bindings">
        <list>
          <bean class="org.apache.mina.integration.spring.Binding">
            <property name="address" value="127.0.0.1:1626"/>
            <property name="handler" ref="smusHandler"/>
          </bean>
          <bean class="org.apache.mina.integration.spring.Binding">
            <property name="address" value="127.0.0.1:8888"/>
            <property name="handler" ref="smusHandler"/>
          </bean>
          <bean class="org.apache.mina.integration.spring.Binding">
            <property name="address" value="127.0.0.1:8282"/>
            <property name="handler" ref="adminHandler"/>
          </bean>
        </list>
      </property>
    </bean>

</beans>
-- 
---------------------------------------------
  http://www.humantools.com

Mime
View raw message