Enable asynchronous rating
Change PolicyCenter to use an asynchronous process for rating instead of the synchronous process that the base configuration provides.
Procedure
- Find and edit the gw.job.QuoteProcess class in Studio.
-
Remove the call to
handleQuoteResponse. - Decide where to inject your rating code. Carefully consider where you want to inject your rating code. The result has large consequences for how you design your asynchronous messaging code. For example, do you want just one message payload per policy, or one per slice date?
-
Wherever you decide to add your rating
code, instead of a synchronous call to your rating engine, add the
RequestQuotemessaging event. A messaging event is a special signal that triggers the Event Message rule set in the same database transaction as the current Gosu code. - Write new Event Fired rule set rules that listen for the event and generate a message payload for your rating engine. It would contain important information from your policy so that it could generate prices for everything.
- Write a messaging transport that calls out to your rating external system.
- Eventually your messaging transport gets a response. During the message acknowledgement (message reply) part of your messaging plugin code, create and attach the raw cost entities based on the rating engine response.
- Finally, your messaging transport tells PolicyCenter that rating is complete by calling the handleQuoteResponse method on the quote process.
What to do next
Whether you use synchronous or asynchronous rating, with the built-in rating engine architecture, if an exception occurs during rating, you must mark the quote as invalid.
See also
