Mule
  1. Mule
  2. MULE-4784

Endpoint filters not applied when invokes via the quartz:job-endpoint

    Details

    • Type: Patch submission Patch submission
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 2.2.1
    • Fix Version/s: 3.0.1, 3.1.0
    • Component/s: Transport: Quartz
    • Labels:
      None
    • Environment:

      jdk: 1.6
      jre: java-6-sun-1.6.0.16
      OS: ubuntu 9.0.4

    • User impact:
      Low
    • Configuration:
      Hide

      <?xml version="1.0" encoding="UTF-8"?>
      <mule xmlns="http://www.mulesource.org/schema/mule/core/2.2"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:context="http://www.springframework.org/schema/context"
      xmlns:file="http://www.mulesource.org/schema/mule/file/2.2"
      xmlns:quartz="http://www.mulesource.org/schema/mule/quartz/2.2"
      xsi:schemaLocation="
      http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
      http://www.mulesource.org/schema/mule/file/2.2 http://www.mulesource.org/schema/mule/file/2.2/mule-file.xsd
      http://www.mulesource.org/schema/mule/quartz/2.2 http://www.mulesource.org/schema/mule/quartz/2.2/mule-quartz.xsd
      http://www.mulesource.org/schema/mule/core/2.2 http://www.mulesource.org/schema/mule/core/2.2/mule.xsd">

      <context:property-placeholder location="classpath:META-INF/properties/test.properties"/>

      <file:endpoint connector-ref="FileConnector" name="FileSource" path="$

      {source.path}

      " moveToDirectory="$

      {sent.dir}

      ">
      <file:filename-wildcard-filter pattern="*.txt"/>
      </file:endpoint>

      <file:connector name="FileConnector" />

      <model>

      <service name="Directory Polling Service">

      <description>
      Wake up and check the folder for files
      </description>

      <inbound>
      <quartz:inbound-endpoint jobName="FilePollingJob" cronExpression="$

      {cron-expression}

      ">
      <quartz:endpoint-polling-job>
      <quartz:job-endpoint ref="FileSource"/>
      </quartz:endpoint-polling-job>
      </quartz:inbound-endpoint>
      </inbound>

      <outbound>
      <pass-through-router>
      <file:outbound-endpoint path="$

      {dest.dir}

      " outputPattern="#[ORIGINALNAME]-processed"/>
      </pass-through-router>
      </outbound>

      </service>

      </model>

      </mule>

      Properties :

      source.path=/home/david/pplusnt/PPDB0003/
      upload.dir=/home/david/ABFFlex/uploadQueue
      upload.dir=/home/david/ABFFlex/uploadQueue
      cron-expression=0/30 * * * * ?

      Show
      <?xml version="1.0" encoding="UTF-8"?> <mule xmlns="http://www.mulesource.org/schema/mule/core/2.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:file="http://www.mulesource.org/schema/mule/file/2.2" xmlns:quartz="http://www.mulesource.org/schema/mule/quartz/2.2" xsi:schemaLocation=" http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd http://www.mulesource.org/schema/mule/file/2.2 http://www.mulesource.org/schema/mule/file/2.2/mule-file.xsd http://www.mulesource.org/schema/mule/quartz/2.2 http://www.mulesource.org/schema/mule/quartz/2.2/mule-quartz.xsd http://www.mulesource.org/schema/mule/core/2.2 http://www.mulesource.org/schema/mule/core/2.2/mule.xsd "> <context:property-placeholder location="classpath:META-INF/properties/test.properties"/> < file:endpoint connector-ref="FileConnector" name="FileSource" path="$ {source.path} " moveToDirectory="$ {sent.dir} "> < file:filename-wildcard-filter pattern="*.txt"/> </ file:endpoint > < file:connector name="FileConnector" /> <model> <service name="Directory Polling Service"> <description> Wake up and check the folder for files </description> <inbound> <quartz:inbound-endpoint jobName="FilePollingJob" cronExpression="$ {cron-expression} "> <quartz:endpoint-polling-job> <quartz:job-endpoint ref="FileSource"/> </quartz:endpoint-polling-job> </quartz:inbound-endpoint> </inbound> <outbound> <pass-through-router> < file:outbound-endpoint path="$ {dest.dir} " outputPattern="# [ORIGINALNAME] -processed"/> </pass-through-router> </outbound> </service> </model> </mule> Properties : source.path=/home/david/pplusnt/PPDB0003/ upload.dir=/home/david/ABFFlex/uploadQueue upload.dir=/home/david/ABFFlex/uploadQueue cron-expression=0/30 * * * * ?
    • Similar Issues:
      MULE-4146Global file endpoint ignores the filename wildcard filter
      MULE-3031Filters do not apply when they are configured in an outboud's endpoint
      MULE-3433file connector ignores custom messageReceiver defined in service-overrides, when file endpoint is used with quartz endpoint
      MULE-5837Error at startup when a sub-flow is invoked twice via flow-ref
      MULE-5737Flows does not handle exception when invoked via i) request-response vm inbound endpoint ii) flow-ref
      MULE-1464defaultInboundTransformer is not applied to a global-endpoint
      MULE-6298Flow with a splitter followed by a filter, returns original collection if no item passes the filter, instead of null message
      MULE-7913Scatter-gather: NPE when applying expression filter
      MULE-5432Transformers applied twice when transformFirst=true
      MULE-182JmsSelectorFilter should not throw exception when invoked

      Description

      When I attempt to utilize a quartz-endpoint-polling-job to grab files from a file-endpoint, the <file:filename-wildcard-filter> I have configured on the file-endpoint is NOT applied, and ALL of the files in the specified directory are processed including sub-directories

        Activity

        David Kjerrumgaard created issue -
        Hide
        David Kjerrumgaard added a comment -

        The problematic class is or.mule.transport,quartz.EndpointPollingJob,

        public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {

        ....

        try
        {
        MuleClient client = connector.getClient();
        logger.debug("Attempting to receive event on: " + jobConfig.getEndpointRef());

        /* PROBLEM OCCURS ON THE NEXT LINE.
        *

        • The code needs to handle InboundEndpoints and OutBoundEndpoints differently, specifically
        • applying the filters to InboundEndpoints.....
          */
          MuleMessage result = client.request(jobConfig.getEndpointRef(), jobConfig.getTimeout());

        if (result != null)
        {
        if (logger.isDebugEnabled())

        { logger.debug("Received event on: " + jobConfig.getEndpointRef()); }

        //we need to do this because
        result = (MuleMessage)((ThreadSafeAccess)result).newThreadCopy();

        //Add the context properties to the message.
        result.addProperties(jobDataMap, PropertyScope.INVOCATION);

        receiver.routeMessage(result);
        }
        }
        catch (MuleException e)

        { throw new JobExecutionException(e); }
        Show
        David Kjerrumgaard added a comment - The problematic class is or.mule.transport,quartz.EndpointPollingJob, public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { .... try { MuleClient client = connector.getClient(); logger.debug("Attempting to receive event on: " + jobConfig.getEndpointRef()); /* PROBLEM OCCURS ON THE NEXT LINE. * The code needs to handle InboundEndpoints and OutBoundEndpoints differently, specifically applying the filters to InboundEndpoints..... */ MuleMessage result = client.request(jobConfig.getEndpointRef(), jobConfig.getTimeout()); if (result != null) { if (logger.isDebugEnabled()) { logger.debug("Received event on: " + jobConfig.getEndpointRef()); } //we need to do this because result = (MuleMessage)((ThreadSafeAccess)result).newThreadCopy(); //Add the context properties to the message. result.addProperties(jobDataMap, PropertyScope.INVOCATION); receiver.routeMessage(result); } } catch (MuleException e) { throw new JobExecutionException(e); }
        Hide
        David Kjerrumgaard added a comment -

        I have implemented a slight code change to the EndpointPollingJob class, which checks to see if the configured endpoint is an InboundEndpoint, and if so, uses the InboundEndpoint's request method, which incorporates the endpoint's configured filters & transformers automatically.

        I have attached the code, which I have tested and confirmed that it is working with the code from the 2.2.6-SNAPSHOT codebase.

        Show
        David Kjerrumgaard added a comment - I have implemented a slight code change to the EndpointPollingJob class, which checks to see if the configured endpoint is an InboundEndpoint, and if so, uses the InboundEndpoint's request method, which incorporates the endpoint's configured filters & transformers automatically. I have attached the code, which I have tested and confirmed that it is working with the code from the 2.2.6-SNAPSHOT codebase.
        David Kjerrumgaard made changes -
        Field Original Value New Value
        Attachment EndpointPollingJob.java [ 12629 ]
        Mike Schilling made changes -
        Issue Type Bug [ 1 ] Patch submission [ 5 ]
        Fix Version/s Bug Backlog [ 10522 ]
        Priority To be reviewed [ 6 ] Critical [ 2 ]
        Dirk Olmes made changes -
        Assignee Mike Schilling [ mike.schilling ]
        Mike Schilling made changes -
        Fix Version/s 3.0.1 [ 10877 ]
        Mike Schilling made changes -
        Link This issue blocks BL-294 [ BL-294 ]
        Hide
        Mike Schilling added a comment -

        This works correctly in 3.x, possibly as a result of http://fisheye.codehaus.org/changelog/mule/?cs=15672

        Show
        Mike Schilling added a comment - This works correctly in 3.x, possibly as a result of http://fisheye.codehaus.org/changelog/mule/?cs=15672
        Mike Schilling made changes -
        Status Open [ 1 ] Closed [ 6 ]
        Fix Version/s 3.1.0 [ 10898 ]
        Resolution Fixed [ 1 ]
        Hide
        Travis Carlson added a comment -

        DZ (from QA spreadsheet): integrate config and create an automated test

        Show
        Travis Carlson added a comment - DZ (from QA spreadsheet): integrate config and create an automated test
        Ramiro Rinaudo made changes -
        Workflow Fixed Main Mule Workflow (after JIRA upgrade) [ 76479 ] Main Mule Workflow v1.0 [ 137077 ]
        Ramiro Rinaudo made changes -
        Fix Version/s Bug Backlog [ 10522 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Closed Closed
        239d 2h 23m 1 Mike Schilling 05/Nov/10 06:09 PM

          People

          • Assignee:
            Mike Schilling
            Reporter:
            David Kjerrumgaard
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development