Announcement Announcement Module
Collapse
No announcement yet.
pickup file, copy to archive, process, delete source Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • pickup file, copy to archive, process, delete source

    I have a requirement to pick up a file, process it and deliver onto JMS and also store the file sent to JMS in the archive. The source file needs to be archived and the source deleted to prevent it being processed again. I need to always archive the source even if downstream processing fails.


    I have done this by wire-tapping the file then a bridge (so we always copy and delete the source) and recipient router (one to send via JMS, one to delete original) - I have skipped the process part below.

    This seems too complicated - is there any easy way to achieve this?




    <int-file:inbound-channel-adapter id="SMTP.EDIFACT.READER-1"
    directory="${EDIFACT.SRC.DIRECTORY}" prevent-duplicates="true" scanner="recursiveScanner"
    channel="PAYLOAD.INBOUND.COPY.IN-1" >
    <!-- lock this file -->
    <int-file:nio-locker/>
    </int-file:inbound-channel-adapter>

    <int:channel id="PAYLOAD.INBOUND.COPY.IN-1">
    <int:interceptors>
    <int:wire-tap channel="PAYLOAD.INBOUND.WIRETAP" />
    </int:interceptors>
    </int:channel>



    <!-- just a bridge, new transaction, so we can copy files via a wire-tap first, even if the next channel fails -->
    <int:bridge input-channel="PAYLOAD.INBOUND.COPY.IN-1" output-channel="PAYLOAD.INBOUND.SMTP.FILES.IN"/>


    <!-- route to two channels - one to delete original file, one to deliver to outbound queue -->
    <int:recipient-list-router id="PAYLOAD.INBOUND.SMTP.FILES.OUT.ROUTER" input-channel="PAYLOAD.INBOUND.SMTP.FILES.IN">
    <int:recipient channel="PAYLOAD.INBOUND.SMTP.FILES.OUT.STAGE2"/>
    <int:recipient channel="PAYLOAD.INBOUND.SMTP.FILES.OUT.STAGE3"/>
    </int:recipient-list-router>

    <int-file:outbound-channel-adapter
    directory="${PAYLOAD.INBOUND.COPY.DIRECTORY}"
    filename-generator="new-filename-generator"
    delete-source-files="false" channel="PAYLOAD.INBOUND.WIRETAP" />

    <int-jms:outbound-channel-adapter
    explicit-qos-enabled="true"
    extract-payload="true" connection-factory="connectionFactory"
    id="PAYLOAD.INBOUND.SMTP.FILES.QUEUE.STAGE2"
    channel="PAYLOAD.INBOUND.SMTP.FILES.OUT.STAGE2"
    destination="PAYLOAD.INBOUND.SMTP.PRIORITY.QUEUE">
    </int-jms:outbound-channel-adapter>

    <bean id="PAYLOAD.INBOUND.SMTP.PRIORITY.QUEUE" class="org.apache.activemq.command.ActiveMQQueue">
    <constructor-arg value="PAYLOAD.INBOUND.SMTP.PRIORITY.QUEUE"/>
    </bean>

    <int-file:outbound-channel-adapter
    id="PAYLOAD.INBOUND.PROCESSED.DIRECTORY"
    directory="${PAYLOAD.INBOUND.PROCESSED.DIRECTORY}"
    filename-generator="new-filename-generator" delete-source-files="true"
    channel="PAYLOAD.INBOUND.SMTP.FILES.OUT.STAGE3" />
Working...
X