Skip to Content
avatar image
Former Member

Introduce delay of 7 Days for each message of a particular type.

I have a requirment that after receiving a message of a particular type, PI will hold the message for 7 days before processing, originally I thought a wait step in BPM maybe the appropriate solution but it isnt. (Memory usage/BPM blocking)....

Im not sure what the best approach is to meet this requirment, other than a completely custom solution (custom table to store the message - with a background task that continues to process after 7 days).

Ideally the solution will use the PI standard fucntionalty/tools to implement the solution, even using the file adapter to write the messages to the file system and then coming back and reporocessing in 7 days ....

Im not sure ...

Any input ?

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

4 Answers

  • avatar image
    Former Member
    Oct 05, 2010 at 03:37 AM

    Hi Richard,

    definitely, BPm can do that but it will be performance consuming.

    Chack the below code in your UDF in Message mapping :

    { try

    { Thread.sleep (604800);

    }

    catch (InterruptedException ie){}

    return a;

    }

    Thread.sleep will stop the processing of mapping for the given period of time. We need to provide the required time delay in the bracket as shown in code snippet. (604800). The time is in milli second. (604800) will give you the result after 7 day(72460601000).

    I have used the try catch block to catch the thread exception.

    We can use this UDF in between the main nodes to insert the delay. This is a small thing but very useful.

    But, make sure that you arent applying this in large number of messages, else your PI Integration Engine will be down.

    Can you exolain in detail what kind of messages you are using .

    Regards,

    Sushama

    Add comment
    10|10000 characters needed characters exceeded

    • You can definitely use Thread.sleep(msec) to delay ur message processing.

      However, I would like to highlight follwoing points to be taken care:-

      1. U should use it only for the messages whose frequency is not very high.

      2. It is not suggested to use it for synchronous communication. Becoz ur sender CC(adapter) will throw timeout error if ur waiting time is too big(7 days in ur case).

      If ur scenario is not any one of above then u can safely use it to delay ur message processing.

  • Oct 05, 2010 at 03:56 AM

    other alternative is, if your sender system is file then you can go for shell script to move file fron one directory to other,that means create one directory to move files whioch has particular message type,your shell script suppose to have this logic. this can be done.

    then develop individual interface and schedule it for 7 days.

    BPM,UDF create performance issues.

    Regards,

    raj

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 05, 2010 at 05:17 AM

    Ive had a bit of a think about this ... here is what Im thinking, given there is no defintative way of doing this correctly...

    1. Inbound File adapter reads inbound files.

    2. Transform and write the file to an outbound directory with a specific fileName mask "Day1_name.xml" based on a UDF.

    3. Create 7 File Adapters each running on seperate days 1 -> 7 picking up Files of a specific mask "Day1_*" (Day1 == monday and so on)

    4. Write the file to its ultimate destination and archieve the message when the correct file adapter is triggered.

    Advantages;

    1. No OS involvment - whilst writing a CRON job (shell script) to do this would be relatively simple it does add another point of failure.

    2. No excessive wait times/resource usage on PI

    3. In the event of a PI crash the file system will be intact where as thread.sleep(?????) will not be.

    Disadvantages;

    1. Given the possible downfalls of other solutions this seems to be best.

    Am I missing anything ...

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 14, 2010 at 12:54 AM

    Ended up with a shell script to delay by 7 days, path of least resistence ...

    thanks

    Add comment
    10|10000 characters needed characters exceeded