0

The situation like this, if you are developing an application that manages an inventory and when a product reaches to its re-order level, your application should automatically populate and send a purchase order to the supplier. Then how is it possible through triggers?

2
  • Why triggers? Why can't your application just check the data itself and invoke the service? Commented Feb 1, 2012 at 5:04
  • 1
    In a production system, I would imagine these kind of tasks would run as batch processes once a day or every so many hours or something - I mean think about it. Does it really matter if the supplier get's a purchase order the instant you reach re-order level or a couple hours later with all the other items for that day in bulk? Commented Feb 1, 2012 at 5:06

2 Answers 2

1

Create an ON UPDATE trigger which checks the stock level and then invokes your external purchase-order-creator when it's below a threshold.

Do you have a more specific question, possibly with some code?

Sign up to request clarification or add additional context in comments.

1 Comment

I wander how this would work with transactions... would the call just be postponed until if/when the transaction was committed?
1

Having triggers invoke external business services seems rather awkward.

Here are some other options:

  1. Have the application be responsible for checking the data and invoking the service.

  2. If the data is being updated by multiple applications, create a middle-man business service that will be responsible for updating the data and invoking the service through which all other applications must go through

  3. Invoke the service through a batch process that runs every few hours, daily etc.. As in my comment, does it really matter if the supplier receives purchase orders within seconds?

  4. If you really want to use triggers, you could use triggers to populate a 'Pending purchase orders' table in combination with a batch process that would periodically create purchase orders using data from table.

Just my two cents

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.