Topic
21 replies Latest Post - ‏2014-02-12T02:13:39Z by owenc
Romy01
Romy01
86 Posts
ACCEPTED ANSWER

Pinned topic Customize Task Notification on BPM 8.0

‏2013-01-11T22:37:20Z |
With IBM BPM there is an option to enable task notification via Email whenever a task is assigned to participant using the user profile settings available from Process Portal. Enabling this option will always send task notifications.However, there is a business need to customize sending such notifications wherein notifications needs to be send only at desired tasks and not on every tasks. With some research , we found setting the "Task Notification" user attribute programatically to update the notification values but they don't seem to take effect until the ProfileCache is reset with the new value. Is there any way to access and reset the mentioned Process Server cache ?

This approach would be something that may need hacking into product API's and hence not a supported approach. Need suggestions or ideas to achieve the same

Thanks,
Ramesh
Updated on 2014-07-16T15:57:05Z at 2014-07-16T15:57:05Z by kolban
  • Romy01
    Romy01
    86 Posts
    ACCEPTED ANSWER

    Re: Customize Task Notification on BPM 8.0

    ‏2013-01-14T16:14:20Z  in response to Romy01
    Any suggestions
    • SystemAdmin
      SystemAdmin
      7615 Posts
      ACCEPTED ANSWER

      Re: Customize Task Notification on BPM 8.0

      ‏2013-01-15T15:53:54Z  in response to Romy01
      I think John's approach is the only one that will work for you. Your thought about changing the user preference would likely not scale. If there are 2 parallel instances that the same user is working on, and one reaches a task that should send an e-mail at the same time as the other reaches a task where you don't want an e-mail, flipping the global user preference for receiving an e-mail (if it works) would likely either result in the person getting 2 emails, one of which they don't want, or no e-mails where they should have gotten 1.

      What would be really annoying about that is it woud be an intermittent issue where the user would complain, but you would be hard pressed to replicate the scenario. Additionally your solution would wind up affecting every process application on the system, not just the one you are currently creating. And those other apps might have no idea why users are only seeing their notifications sometimes.

      Andrew Paier | Director of Special Operations | BP3 Global, Inc. www.bp-3.com
      • kolban
        kolban
        3314 Posts
        ACCEPTED ANSWER

        Re: Customize Task Notification on BPM 8.0

        ‏2013-01-15T16:47:51Z  in response to SystemAdmin
        How about explicit modeling? (See attached screen shot). What about the merits or drawbacks of this notion?

        Neil
        • jmac_EmeriCon
          jmac_EmeriCon
          263 Posts
          ACCEPTED ANSWER

          Re: Customize Task Notification on BPM 8.0

          ‏2013-01-15T17:10:55Z  in response to kolban
          Neil:

          How would the Send notification know the task Id? I am assuming here that what you send will have a "click-able" link. Maybe I am missing something here?

          I use something like the attached.


          _______________________________________________________________________

          John McDonald

          EmeriCon, LLC
          • kolban
            kolban
            3314 Posts
            ACCEPTED ANSWER

            Re: Customize Task Notification on BPM 8.0

            ‏2013-01-15T17:30:15Z  in response to jmac_EmeriCon
            Hi John,
            I like your solution much better. I had neglected to consider the notion that the email would want to include the "identity" of the task. I had assumed that the email would simply say "There is a task waiting your attention". This would then prompt the user to go to their portal to see the task details. Your solution allows the email to contain a link directly to the task.

            I am assuming here that you are using the "zero value" timer technique to wake up the timer immediately after the task has been created.

            I used to work with the old WebSphere Process Server product and it too had a whole Human Task management system. One of its features was the ability to name the equivalent of a "service" that would be invoked at life cycle events associated with the task such as:

            1. When it was created
            2. When it was escalated
            3. When it was claimed
            4. When it was completed

            This optional service allowed the designers to accommodate a wealth of options/permutations.

            I am wondering if we might want to create an IBM Request for Enhancement to see if such a notion might also make sense in the new IBM BPM BPMN modeling story.

            Neil
            • jmac_EmeriCon
              jmac_EmeriCon
              263 Posts
              ACCEPTED ANSWER

              Re: Customize Task Notification on BPM 8.0

              ‏2013-01-15T17:39:06Z  in response to kolban
              Neil:

              I can think of at least half a dozen things from MQWF and BPEL style processes, that I would like to see in this product.

              This is a pretty easy workaround, so it would be lower on my list of things to add. Higher would be one that would help in this one. This is easily solved with the concept of the Exit Condition, originally from MQWF, and eventually added to the BPEL engine. You want to change the time, you simply have a button that ends the task, it then fails the exit condition and you have your new timer value set. Doing the same thing with the model is of course possible, but it tends to muck things up.

              John


              _______________________________________________________________________

              John McDonald

              EmeriCon, LLC
  • jmac_EmeriCon
    jmac_EmeriCon
    263 Posts
    ACCEPTED ANSWER

    Re: Customize Task Notification on BPM 8.0

    ‏2013-01-14T16:55:42Z  in response to Romy01
    In cases where I want to send an Email to notify a user that there is a task to be run, I have done this by putting an attached Timer, with a 0 expiration (i.e. it fires once the task is ready) and then have this event send the email. If I am understanding you correctly this will allow you to work around the issue you are facing with the API.

    John


    _______________________________________________________________________

    John McDonald

    EmeriCon, LLC
    • AnthonyBpm
      AnthonyBpm
      390 Posts
      ACCEPTED ANSWER

      Re: Customize Task Notification on BPM 8.0

      ‏2013-01-15T17:47:39Z  in response to jmac_EmeriCon
      Setting any timer event attached to a task with a 0 fire time has an inherent negative performance impact. This is especially important to consider if you are using a multi-instance loop. If the business requires immediate notification upon task creation, then there's no way around it other than to monitor your performance and scale the infrastructure when appropriate.

      Otherwise, I recommend incorporating at least a minute delay between task creation and timer event firing. It will alleviate stress on the system. The stress is associated with spacing out the work that needs to be done by the event manager to create the task and the work required by the system to process the service that sends the email.
      • jmac_EmeriCon
        jmac_EmeriCon
        263 Posts
        ACCEPTED ANSWER

        Re: Customize Task Notification on BPM 8.0

        ‏2013-01-15T17:58:48Z  in response to AnthonyBpm
        Anthony:

        Can you supply a link to someplace where this is discussed?

        This sounds like a product bug to me.

        John


        _______________________________________________________________________

        John McDonald

        EmeriCon, LLC
        • AnthonyBpm
          AnthonyBpm
          390 Posts
          ACCEPTED ANSWER

          Re: Customize Task Notification on BPM 8.0

          ‏2013-01-15T18:56:56Z  in response to jmac_EmeriCon
          Why does it sound like a product bug? There is no "defect". It's developing with environment performance in mind. The concept I discuss is partially documented within this Webcast, Developing for Performance and Scalability.

          Do you consider it a product bug that an individual can model 5 system lanes in a row or that an individual can model an infinite BPD loop?

          Like I eluded to previously, the timer can be fired immediately because business requirements may outweigh the importance of performance. If you have the flexibility with your business requirement to include performance related considerations, then great.
          • jmac_EmeriCon
            jmac_EmeriCon
            263 Posts
            ACCEPTED ANSWER

            Re: Customize Task Notification on BPM 8.0

            ‏2013-01-15T19:13:46Z  in response to AnthonyBpm
            Based on your original append, I was thinking that there was possibly some race issue here.

            I attended the original presentation and still have my notes, and do not recall anything regarding timers being mentioned as an issue with performance. I guess what you are saying is that since this timer should fire immediately, that it is similar in nature to having multiple consecutive services in the System Lane?

            John

            _______________________________________________________________________

            John McDonald

            EmeriCon, LLC
            • AnthonyBpm
              AnthonyBpm
              390 Posts
              ACCEPTED ANSWER

              Re: Customize Task Notification on BPM 8.0

              ‏2013-01-15T19:41:21Z  in response to jmac_EmeriCon
              If it were a race condition, then yes that would definitely be a defect and I would have used all caps, bolded, and underlined the text while hopefully linking to the hotfix for it :)

              Also, I referenced Dave's performance webcast because while it does not directly talk about timers, my recommendation is related to topics discussed within that webcast. The only other place I've seen this referenced is where I've called it out .. I didn't think it would be fair to link to my own comments. I might as well have linked to my post within this thread.

              "I guess what you are saying is that since this timer should fire immediately, that it is similar in nature to having multiple consecutive services in the System Lane?" - Similar concept, yes. I don't know if it is exactly the same; but it's a performance consideration nonetheless.
      • SystemAdmin
        SystemAdmin
        7615 Posts
        ACCEPTED ANSWER

        Re: Customize Task Notification on BPM 8.0

        ‏2013-01-15T20:15:28Z  in response to AnthonyBpm
        Hmmmm… I'm unconvinced that the amount of time on the timer would in any meaningful way help or hurt performance. Ignoring the fact that there is a bug in Multi Instance Loops that have a high loop number that engineering really should solve one day (and its stupid that it is there since it is only a problem due to lazy book keeping), If I was running a performance test where I wanted to push as many of these tasks through the server as fast as possible, I don't see where adding a 1 minute delay to the timer actually would affect the throughput while the system is running flat out.

        No matter how you slice it, the engine is going to have to handle 2 events. 1) Create the task. 2) Send the e-mail. Putting a 1 minute timer between those doesn't buy you anything. If I time how long it takes to get a milliion of those done, I doubt I would see a significant difference between the one with a 0 minute wait and a 1 minute wait.

        So then Andrew, why do some of us have this opinion about timers? Ahhh… well lets take MIL back into consideration. The stupid bug here is essentially to do with 2 facts

        1. BPD token movement is singly threaded. This to reduce complexity that would add little to know business value.
        2. Rather than actually have a mechanism to monitor the threads and dedicate one per BPD instance, the engine handles this by locking the BPD record when it is being processed by a given thread. This is the book keeping problem I alluded to earlier.

        So how/why does this cause a problem? Well, each item in the MIL basically puts its own entry in the event manager. On the next sweep of the table the EM picks all of them up and trys to start executing them. One of them wins the lock and the others get locked out. When the one that won unlocks, another thread gets a lock and it processes. And so on. This pretty much sucks becuase we just singly threaded our entire EM since if I have enough of these, other EM items are backing up behind them.

        Generall this is not a problem. If your # is low (not in the 100's or above) or if you design you BPD correctly this momentary choke goes unnoticed. But if you follow some patterns, you will break things. The easiest way to have it break is to have many items in your loop and to have the first thing that happens inside the loop be a relatively expensive system lane activity. What happens then? Well if everything lines up just wrong, one of your threads in you EM queue just keeps losing the lock lottery. When that happens its DB connection times out or is picked as a dead lock victim. This in turn causes a jdbc exception which puts the entire BPD into a "failed" state.

        If you notice the failed BPD you can just resume it, and it should work, assuming it doesn't repeat the deadlock problem. So this isn't data loss or anything, just really annoying.

        So, how do timers factor into this? Well one of the ways to reduce the odds of this happening, if you happen to have to launch a high number of MIL items and can't avoid a system lane item as the first thing, is to put a timer in before the system lane event. All this really does is spread out the BPD events over a longer period of time so the odds of the lock occuring will be reduced. A timer with zero would actually make the problem worse as the engine is smart enough to look at that and say "Hey, we aren't done moving all the tokens, this one can move, lets move it" makeing the thread that is "wining" take just that little bit longer.

        Because of this locking model, there is no gurantee that a MIL will never fall victim to this problem. Even if your first activity is a simple human activity, if you are issueing enough of them eventually you will manage flip a coin 20 times and have all the flips be heads. And then that instance will fail. I've been asking to address this issue since 2007. Someday it will make it into the product.

        To be honest, I haven't checked it on 8.0.1 yet, so maybe it already has.

        Andrew Paier | Director of Special Operations | BP3 Global, Inc. www.bp-3.com
        • AnthonyBpm
          AnthonyBpm
          390 Posts
          ACCEPTED ANSWER

          Re: Customize Task Notification on BPM 8.0

          ‏2013-01-15T21:19:40Z  in response to SystemAdmin
          Yes the MIL "lock lottery" is an issue along with performance related concerns. Lets say the BPD doesn't fail and it runs smoothly, your environment gets hit with processing the MIL task creation along with handling the additional system lane/timer related "stuff" that needs to be processed. While this won't fail the BPD and you've won the "lock lottery", it will cause resource hiccups which will ultimately be noticed by end-users trying to access/use the environment while the MIL is being handled.

          On to: "If I time how long it takes to get a million of those done, I doubt I would see a significant difference between the one with a 0 minute wait and a 1 minute wait."

          If you don't wait that minute or X minutes, you're doing 2 million things all at once vs. 1 million immediately and then 1 million a little bit later. The events are actually 1. create the task, 2. evaluate timers, 3. fire timer or add to event manager queue, 4. execute timer path (in this case run service to send an email). I'd bet a virtual beer, coffee, or tea there would be a significant enough performance impact to make you pay up :)
          • SystemAdmin
            SystemAdmin
            7615 Posts
            ACCEPTED ANSWER

            Re: Customize Task Notification on BPM 8.0

            ‏2013-01-18T19:37:06Z  in response to AnthonyBpm
            There is a defined number of threads allocated to processing BPD tokens and service execution. The OOTB number is way below one hundred. This means if we kick off something that is going to put items into the EM Queue quicker than they can be processesed, there will be a backlog. The typical enviornment has 20-50 threads for his processing. So, at any given moment, running flat out, it is going to be doing 20-50 items in parallell. Not a million. So adding in a 1 minute time delay (again, unless we are in a MIL) doesn't buy you anything. Actually it likely causes a slow down. Why is this? Well lets go back to how the BPD engine works.

            1. Event to move BPD tokens comes into the EM queue.
            2. EM sweeps the table, picks up available events and assigns them to threads for processing.
            3. The thread examines all the tokens for one that can be moved forward.
            4. The identified token moves forward.
            5. If it lands on a human service, a task is created and that token stops. The thread goes back to #3.
            6. If it lands on a system service, that service is executed. When the execution completes we go back to #3
            7. The loops above continue on the thread until #3 says "No tokens to move".

            By adding in a 1 minute timer, you actually will cause the thread to go back to the pool, and assigned to another BPD for processing and an extra EM task to be generated and processed. You've essentially increased the the number of DB transactions to get the same end result of what is run by the system.

            Now, if you are examining "How long does it take for all my human tasks to be generated", the pattern that uses a 1 minute timer may win as long as we aren't talking too many events, simply because you have decided on a pattern that ensures that. If you are examining "How long does it take for all my human tasks to be generated and for all the e-mails to be sent" then there is going to be little to no difference between the 2 models. As a matter of fact it I'm only sending say 10 tasks, your model would show up as ~ 1 minute slower for that metric (although with lower peaks on CPU use over that time). When we get up to many many tasks (basically enough so that we've been lanuching BPDs for more than minute) the timers and task creations are still going to wind up intermixed, so the one minute delay doesn't buy anything.

            Basicaly you have a pipe that can allow X amount of work through in a given time slice. You have Y amount of work to do. It should take you Y/X time slices to get the work done. It doesn't matter if you change it so that A+B = Y, in then you just get that the total time will be (A+B)/X which is == to Y/X
            Andrew Paier | Director of Special Operations | BP3 Global, Inc. www.bp-3.com
            • AnthonyBpm
              AnthonyBpm
              390 Posts
              ACCEPTED ANSWER

              Re: Customize Task Notification on BPM 8.0

              ‏2013-01-18T20:34:17Z  in response to SystemAdmin
              "By adding in a 1 minute timer, you actually will cause the thread to go back to the pool, and assigned to another BPD for processing and an extra EM task to be generated and processed"

              The timer with 0 minutes and 1 minute both get added to the EM queue for processing, correct? Your step 5 should really say: task is created an additional task events are added to the event manager queue. The EM "brain" will either pick up the timer on its current pass through or during the following pass through where the 1 minute timer will get picked up. Either way, I would suspect it's the same DB transactions and overhead either way.

              I understand that throughput is based on numbers that are ultimately dependent upon thread availability. In the case of non-MILs, including an additional minute provides the event manager with the ability to process other items unrelated to the current task. The EM has a lot of events to process and there is already a lot of work to be done on task creation, without adding the overhead of processing a task email immediately.

              I completely understand where you're coming from and wouldn't be surprised if this scenario were performance tested and you were ultimately correct. But my bet still stands :)
              • SystemAdmin
                SystemAdmin
                7615 Posts
                ACCEPTED ANSWER

                Re: Customize Task Notification on BPM 8.0

                ‏2013-01-21T19:14:09Z  in response to AnthonyBpm
                > {quote:title=AnthonyBpm wrote:}{quote}
                ...
                > The timer with 0 minutes and 1 minute both get added to the EM queue for processing, correct?
                ...
                Incorrect. If you read, the BPD evaluates all the tokens before putting the thread back into use. Since the timer token says "Yes sir! I'm ready to move now, the time for me has passed" when you use the 0 based timer, that would avoid the step of adding a book keeping item to the EM task queue and then popping it back off later. This is the same behavior you will see if you did a split to multiple system lane activities, the BPD engine does not put the thread back into the pool until all of the tokens in the BPD come to rest. So in the multiple system lane scenario on thread would handle all the tokens coming out of the split, evaluating each token in the BPD and only returning the thread to the pool when all of the tokes basically say 'Yes boss, I'm suck at this point'.

                Another way to look at this is the BPD engine needs to do work when it reaches the timer. That work is either a) write something out so the EM triggers on this thing later or b) move the token. The developer decided to attempt to be efficient and check if the timer had yet fired before writing the record to the EM table, and if it had, then move the token.

                Andrew Paier | Director of Special Operations | BP3 Global, Inc. www.bp-3.com
                • SystemAdmin
                  SystemAdmin
                  7615 Posts
                  ACCEPTED ANSWER

                  Re: Customize Task Notification on BPM 8.0

                  ‏2013-01-21T19:44:43Z  in response to SystemAdmin
                  Oh, and before I forget, Multi Instance Loops (which were introduced later to BPDs) do not follow this evaluation pattern. They do write all the records out the EM_TASK table. Not sure why that is, perhaps a different developer was involved. I'd note that if they did not do that write, that is if they actually just evaluated each token in the thread, then the entire problem that large MILs cause would go away as they would not cause the massive DB lock they create today.

                  Andrew Paier | Director of Special Operations | BP3 Global, Inc. www.bp-3.com
                  • SystemAdmin
                    SystemAdmin
                    7615 Posts
                    ACCEPTED ANSWER

                    Re: Customize Task Notification on BPM 8.0

                    ‏2013-03-25T06:15:05Z  in response to SystemAdmin
                    Hello! Does have anybody have info where is email templates are stored in 8.0.1 ? tried to fing resources.jar - no luck.
  • AnthonyBpm
    AnthonyBpm
    390 Posts
    ACCEPTED ANSWER

    Re: Customize Task Notification on BPM 8.0

    ‏2013-01-14T21:00:30Z  in response to Romy01
    The only other way, that might not even be available in 8.0, is within the "teamworks ear" (I don't have an 8.0 installation accessible at the momement) there should be a jar named "resources.jar". Within that JAR you should see html files named something like "externalmailprocesslink". Those files are the "templates" for the notification emails.

    To modify those in previous versions, you have to un-jar, replace, re-jar, and deploy the jar file. You'll either have to restart the environment or stop/start the EAR. You should see the hints of existence for these files within the "99Local.xml" file.

    hth
  • owenc
    owenc
    5 Posts
    ACCEPTED ANSWER

    Re: Customize Task Notification on BPM 8.0 - Task Notification Templates and the Task Narrative field

    ‏2014-02-12T02:13:39Z  in response to Romy01

    In my IBM BPM v8.01 installation, the templates can be found in:

    C:\IBM\WebSphere\AppServer\BPM\Lombardi\process-server\lib\procsrv_resources.jar\

    There are three types of templates (here are the English ones):

    • externalmailnoprocess_en.html
    • externalmailprocess_en.html
    • externalmailprocesslink_en.html

    Only the "externalmailnoprocess" and "externalmailprocesslink" are used. The first is if a task was started outside of a process and the second is for a task started from a process (I almost almost sure).

    The templates are referenced in the 99Local.xml configuration file here:

    C:\IBM\WebSphere\AppServer\profiles\ProcCtr01\config\cells\IBMBPMNode01Cell\nodes\IBMBPMNode01\servers\server1\process-center\config\system

    Specially, look at this clause:


            <!-- email properties -->
            <email>
                <!-- SMTP server that mail should be sent to -->
                <smtp-server>smtp.yourcompany.com</smtp-server>
                <!-- Information generating the email from templates -->
                <mail-template>
                    <!-- The two templates that should be used to generate the text of -->
                    <!-- the email message. You should choose one "process" and one -->
                    <!-- "noprocess" entry. The process entry is used if the task send -->
                    <!-- has an associated process, the noprocess entry if there is -->
                    <!-- no associated process. externalmailprocess uses javascript -->
                    <!-- and a button to start the process, this does not work with -->
                    <!-- some email clients that disable javascript. If this affects you -->
                    <!-- choose the externalmailprocesslink which uses a link instead. -->
                    <!-- _{0} prefix represents language and is replaced at runtime with lang code (e.g. _en) -->
                    <!-- <process>externalmailprocess_{lang}.html</process> -->
                    <process>externalmailprocesslink_{0}.html</process>
                    <no-process>externalmailnoprocess_{0}.html</no-process>

                    <!-- The URL which defines how to get to the teamworks client to -->
                    <!-- display the provided task. Do not put a trailing slash as the -->
                    <!-- template provides the slash. This URL is also used to generate -->
                    <!-- the url for the background images in the mail if //webImages/prefix -->
                    <!-- not set. -->
                    <client-link>http://IBMBPM:9080/teamworks</client-link>
                </mail-template>
                <!-- If this is set to true then the from address set on external email will  -->
                <!-- include a valid email address, which is either the user's contact email  -->
                <!-- address or the default address below if no contact address is found.      -->
                <valid-from-required>true</valid-from-required>
                <!-- Used when sending external email if the sender has no email contact info set -->
                <default-from-address>twadmin@lombardisoftware.com</default-from-address>
                <send-external-email>true</send-external-email>
            </email>

     

    Now, my advice would be to not change these templates. Otherwise, you have to maintain them every time you upgrade a new version of IBM BPM.

    I had a client request this because they wanted extra data included in the email sent (for example, they wanted some of their local variables included like customer name, etc.).

    To solve this, I suggested that they use the Task Narrative field which is included in the Task Notification email. You can add Javascript and include local variables like this:

    <#= "My variable is equal to " + tw.local.myVariable #>