Announcement Announcement Module
Collapse
No announcement yet.
Unable to properly setup RMI gateways. cannot read message on RMI side Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Unable to properly setup RMI gateways. cannot read message on RMI side

    hello all
    i am trying to setup my app so that spring integ messages are sent to a remote RMI gateway, but i feel i am missing something big as i m receiving this exception when trying to send messages to a remote gateway..

    here's my setup (on the client side)

    Code:
    <si:publish-subscribe-channel id="rmiChannel">
    	  <si:interceptors>
    			<ref bean="countingChannelInterceptor"/>
    		</si:interceptors> 
    	</si:publish-subscribe-channel>
    
    <rmi:outbound-gateway id="rmiGateway"
                           request-channel="rmiChannel"
                           remote-channel="rmiRequestsChannel"
                           host="localhost"
                           port="1235"/>
    and here's the RMI side
    Code:
    <integration:publish-subscribe-channel id="rmiRequestsChannel">
    		<integration:interceptors>
    			<ref bean="rmiChannelInterceptor"/>
    		</integration:interceptors> 
    	</integration:publish-subscribe-channel>
    	
    	<rmi:inbound-gateway id="gatewayWithPort" request-channel="rmiRequestsChannel"
                          registry-port="1235"/>
    	
    	<bean id="receiverService" class="com.sample.services.rmi.ReceiverServiceImpl"/>
    	
    	<bean id ="rmiServer" class="org.springframework.remoting.rmi.RmiServiceExporter">
    		<property name="serviceName" value="ReceiverService"/>
    		<property name="service" ref="receiverService"/>
    		<property name="serviceInterface" value="com.sample.services.rmi.Receiver"/>
    		<property name="registryPort" value="1235"/>
    	</bean>
    	<bean id="rmiChannelInterceptor" class="com.sample.interceptors.CountingChannelInterceptor"/>
    I Know messages are being sent on rmiChannel as the interceptor logs every message i sent.

    Messages are being received on the serverside as well as i have an interceptor configured there as well.

    But they dont get delivered to my RMI Server.

    anyone coudl tell me what i am missing?

    regards
    marco

  • #2
    Hello
    i managed to get message across RMI, but i am not convinced i did it in the right way.
    Problem is that i was unable to link the rmi-inbound-gateway to some object that could read the message.
    In the end i had to amend my serverside spring context this way:
    Code:
    <integration:publish-subscribe-channel id="rmiRequestsChannel">
    		<integration:interceptors>
    			<ref bean="rmiChannelInterceptor"/>
    		</integration:interceptors> 
    	</integration:publish-subscribe-channel>
    	
    	<bean id="rmiChannelInterceptor" class="com.sample.interceptors.CountingChannelInterceptor"/>
    	
    	<bean id="rmiInGateway" class="com.rmi.service.RmiGateway">
        	<property name="registryPort" value="1235"/>
        	<property name="requestChannel" ref="rmiRequestsChannel"/>
        </bean>
    So, i extended the RmiInboundGateway and handled there the logic.

    I am sure there is a better solution.... coudl anyone comment pls?

    rgds
    marco

    Comment


    • #3
      Sorted!
      here's proper serverside rmi xml
      Code:
      <integration:publish-subscribe-channel id="rmiRequestsChannel">
      		<integration:interceptors>
      			<ref bean="rmiChannelInterceptor"/>
      		</integration:interceptors> 
      	</integration:publish-subscribe-channel>
      	
      	<integration:outbound-channel-adapter channel="rmiRequestsChannel" ref="rmiChannelAdapter" method="log">
      	</integration:outbound-channel-adapter>
      	
      	<bean id="rmiChannelInterceptor" class="com.sample.interceptors.CountingChannelInterceptor"/>
      	
      	<rmi:inbound-gateway id="gatewayWithPort" request-channel="rmiRequestsChannel"
                            registry-port="1235"/>
          <bean id="rmiChannelAdapter" class="com.sample.services.RmiChannelAdapter"/>
      As i should have understood earlier, teh gateway is just a gateway that will publish RMI messages onto another channel.
      As i didnt define any subscriber to rmiRequestsChannel, messages werent being read.
      My original misunderstanding came from this piece of configuration
      Code:
      <rmi:inbound-gateway id="gatewayWithPort" request-channel="rmiRequestsChannel"
      I thought that rmi-inbound-gateway was listening to rmiRequestsChannel (as input channel), rather than posting messages to it..

      everything is clearer now

      thanks and regards
      marco

      Comment


      • #4
        Glad you've worked it out! I know that it can be confusing with input/output and request/reply. We tried to devise a consistent strategy, and basically for *inbound* gateways "request-channel" is where the incoming request Messages are sent (after being mapped from some external format), while for *outbound* gateways "request-channel" is where the outgoing Messages are sent (and then mapped to some external request type).

        Does that help? (I know... maybe a bit late for that explanation)

        Comment


        • #5
          Thanks for explanation Mark, i might have been programming by 'coincidence' so far

          Now the next question.

          Any way a RMI outbound gateway can send out so called 'heartbeat' messages, so to announce to the 'framework' that the gateway is still alive?

          or to send out events in case the machine where it is running is being shut down?

          regards
          marco

          Comment

          Working...
          X