based event triggers

I am currently working on a project with specific requirements. A brief overview of these are as follows:

  • Data is retrieved from external webservices
  • Data is stored in SQL 2005
  • Data is manipulated via a web GUI
  • The windows service that communicates with the web services has no coupling with our internal web UI, except via the database.
  • Communication with the web services needs to be both time-based, and triggered via user intervention on the web UI.
  • The current (pre-pre-production) model for web service communication triggering is via a database table that stores trigger requests generated from the manual intervention. I do not really want to have multiple trigger mechanisms, but would like to be able to populate the database table with triggers based upon the time of the call. As I see it there are two ways to accomplish this.

    1) Adapt the trigger table to store two extra parameters. One being "Is this time-based or manually added?" and a nullable field to store the timing details (exact format to be determined). If it is a manaully created trigger, mark it as processed when the trigger has been fired, but not if it is a timed trigger.
    or
    2) Create a second windows service that creates the triggers on-the-fly at timed intervals.

    The second option seems like a fudge to me, but the management of option 1 could easily turn into a programming nightmare (how do you know if the last poll of the table returned the event that needs to fire, and how do you then stop it re-triggering on the next poll)

    I'd appreciate it if anyone could spare a few minutes to help me decide which route (one of these two, or possibly a third, unlisted one) to take.


    Why not use a SQL Job instead of the Windows Service? You can encapsulate all of you db "trigger" code in Stored Procedures. Then your UI and SQL Job can call the same Stored Procedures and create the triggers the same way whether it's manually or at a time interval.


    The way I see it is this.

    You have a Windows Service, which is playing the role of a scheduler and in it there are some classes which simply call the webservices and put the data in your databases.

    So, you can use these classes directly from the WebUI as well and import the data based on the WebUI trigger.

    I don't like the idea of storing a user generated action as a flag (trigger) in the database where some service will poll it (at an interval which is not under the user's control) to execute that action.

    You could even convert the whole code into an exe which you can then schedule using the Windows Scheduler. And call the same exe whenever the user triggers the action from the Web UI.


    @Vaibhav

    Unfortunately, the physical architecture of the solution will not allow any direct communication between the components, other than Web UI to Database, and database to service (which can then call out to the web services). I do, however, agree that re-use of the communication classes would be the ideal here - I just can't do it within the confines of our business*

    *Isn't it always the way that a technically "better" solution is stymied by external factors?

    链接地址: http://www.djcxy.com/p/57474.html

    上一篇: 你如何使用同一个R包的多个版本?

    下一篇: 基于事件的触发器