Results 1 to 6 of 6

Thread: mongodb outbound and specific channel

  1. #1
    Join Date
    May 2013
    Posts
    6

    Default mongodb outbound and specific channel

    Hi,

    I'm trying to configure a queue channel with the mongodb outbound-channel-adapter this way:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xmlns:int="http://www.springframework.org/schema/integration"
    	xmlns:int-mongodb="http://www.springframework.org/schema/integration/mongodb"
    	xsi:schemaLocation="http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.2.xsd
    		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
    		http://www.springframework.org/schema/integration/mongodb http://www.springframework.org/schema/integration/mongodb/spring-integration-mongodb-2.2.xsd">
    
    	<int:channel id="entriesChannel" >
            <int:queue/>
           </int:channel>
        
        <int-mongodb:outbound-channel-adapter id="deafultAdapter" channel="entriesChannel" collection-name="entry" mongo-template="mongoTemplate" />
    
    </beans>
    But I'm getting this xsd validation error:
    Code:
    Referenced file contains errors (http://www.springframework.org/schema/integration/spring-integration-2.2.xsd).  For more information, right click on the message in the Problems View and select "Show Details..."
    Everything else is configured via java annotations (i.e. mongo configuration) because I was not able to find how to configure integration with java annotations and I'm loading this xml through:
    Code:
    @Configuration
    @ImportResource("classpath:some/folder/integration.xml")
    public class IntegrationConfig {
    }
    What am I doing wrong?
    Is there any way to configure integration with java annotations?

    Thanks!

  2. #2
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,029

    Default

    See this thread for avoiding bogus validation warnings in STS.

    Aside from this, when using a queue channel, you will either need a <poller/> child element on the adapter, or a global default poller.

    Several efforts are underway to configure SI without XML (scala and groovy DSLs as well as a java builder mechanism). Some components already can be configured using annotations but currently not external endpoints such as mongo.

    Search the TOC for 'Annotation'.
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

  3. #3
    Join Date
    May 2013
    Posts
    6

    Default

    Thank you for your quick reply
    I had followed your instructions but no luck, even changing workspace and import with explicitly setting the versions (and cleaning/rebuild the project)
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
        xmlns:int="http://www.springframework.org/schema/integration"
        xmlns:int-mongodb="http://www.springframework.org/schema/integration/mongodb"
        xsi:schemaLocation="http://www.springframework.org/schema/beans
    		http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
    		http://www.springframework.org/schema/integration
    		http://www.springframework.org/schema/integration/spring-integration-2.2.xsd
    		http://www.springframework.org/schema/integration/mongodb
    		http://www.springframework.org/schema/integration/mongodb/spring-integration-mongodb-2.2.xsd">
     
        <int:channel id="entriesChannel">
            <int:queue />
        </int:channel>
        
        <int-mongodb:outbound-channel-adapter id="entriesMongoChAdapter" channel="entriesChannel">
        	<int:poller fixed-rate="30000" max-messages-per-poll="1" />
        </int-mongodb:outbound-channel-adapter>
     
    </beans>
    Now I'm getting this error in addition of the previous one:
    Code:
    Description	Resource	Path	Location	Type
    cvc-complex-type.2.1: Element 'int-mongodb:outbound-channel-adapter' must have no character or element information item [children], because the type's content type is empty.

  4. #4
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,029

    Default

    Well, that is definitely a bug; the adapter should allow a <polller/> child element. Please open a JIRA issue: https://jira.springsource.org/browse/INT

    Is there any particular reason you are using a QueueChannel? If you want to asynchronously send to Mongo, you can use an ExcecutorChannel.
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

  5. #5
    Join Date
    May 2013
    Posts
    6

    Default

    Every time I add in the same xml a channel tag (channel with or without queue or publish-subscribe-channel) and int-mongodb:outbound-channel-adapter tag I get the validation error
    Code:
    Referenced file contains errors (http://www.springframework.org/schema/integration/spring-integration-2.2.xsd).  For more information, right click on the message in the Problems View and select "Show Details..."
    Details:
    Code:
    ct-props-correct.4: Error for type 'aggregator-type'. Duplicate attribute uses with the same name and target namespace are specified. Name of duplicate attribute use is 'release-strategy'
    Could you confirm this? this is too odd...I don't know if my STS is messed up...

    EDIT: omg my bad ...I thought spring-integration-core maven dependency will import everything else so I had not added spring-integration-mongodb...everything is working now, sry
    Last edited by poty; May 19th, 2013 at 08:56 AM.

  6. #6
    Join Date
    May 2013
    Posts
    6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •