Announcement Announcement Module
Collapse
No announcement yet.
How to implement FileReadingMessageSource? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to implement FileReadingMessageSource?

    Hi,
    I am new to spring and looked for a solution to poll files for modifications and found this: http://static.springsource.org/sprin...tml/files.html

    So I tried to implement the example and added the first snippet to my config xml (after adding the integration jars) and I got:

    Code:
    org.xml.sax.SAXParseException; lineNumber: 44; columnNumber: 41; The prefix "p" for attribute "p:inputDirectory" associated with an element type "bean" is not bound.
    I think there is an error in the examples, right? Because this throws no error:

    Code:
    <bean id="pollableFileSource"
    		class="org.springframework.integration.file.FileReadingMessageSource">
    		<property name="directory" value="file:."></property>
    	</bean>
    What my problem is now: How do I get information about the changed files? Do I have to implement all this ChannelAdapter stuff?!? And if so: How does that make my life easier?

    Could anyone push me to the right direction to solve this?

    Thanks!!

    Oliver

  • #2
    Can you show the relevant excerpt from your config? It appears that you are trying to use the 'p' namespace (for attributes), but I'm not sure where you're using that.

    Thanks,
    Mark

    Comment


    • #3
      Hi, Mark,
      I simply used the example snippet from the documentation (link in my post):

      Code:
      <bean id="pollableFileSource"
            class="org.springframework.integration.file.FileReadingMessageSource"
              p:inputDirectory="${input.directory}"/>

      Comment


      • #4
        Sorry, I see... you need to change 'inputDirectory' to just 'directory'.

        Could you please open a JIRA issue to fix that in the documentation?

        Thanks,
        Mark

        Comment


        • #5
          I changed it but got the same exception.

          I get a validation error in Eclipse too for that line.

          Should I simply open a JIRA issue without your suggestion?

          Maybe my xml is not correct? The head looks like this:

          Code:
          <beans xmlns="http://www.springframework.org/schema/beans"
          	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
          	xmlns:task="http://www.springframework.org/schema/task" xmlns:tx="http://www.springframework.org/schema/tx"
          	xmlns:integration="http://www.springframework.org/schema/integration"
          	xmlns:file="http://www.springframework.org/schema/integration/file"
          	xsi:schemaLocation="http://www.springframework.org/schema/beans
                     http://www.springframework.org/schema/beans/spring-beans.xsd
                     http://www.springframework.org/schema/context
                     http://www.springframework.org/schema/context/spring-context.xsd
                     http://www.springframework.org/schema/task
                     http://www.springframework.org/schema/task/spring-task.xsd
                     http://www.springframework.org/schema/tx
                     http://www.springframework.org/schema/tx/spring-tx-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/file
                     http://www.springframework.org/schema/integration/file/spring-integration-file-2.2.xsd"
          	default-init-method="init">
          I too forgot to mention that I do not use Maven and simply added the core and file integration jars by hand.

          Comment


          • #6
            If you are using the 'p' namespace you also need to declare that in the XML header.

            See here for an example: http://static.springsource.org/sprin...ns-p-namespace

            Comment


            • #7
              Thanks Mark, that solved it!

              I created a JIRA task: https://jira.springsource.org/browse/INT-3071

              How can I register for messages for this messagesource? Or could you tell me where to start reading?

              Comment

              Working...
              X