Found an Alternate solution that may also work and is even easier.
- Create a DE from Domain Suppression (DS) template
- Create SQL (like below) to add the domain name to DS DE if count > 20000 (Action must be overwrite)
- Set a Domain Exclusion DE inside of the email send in Journey Builder which will dynamically exclude certain domains based on the query from #2.
Just know that these will not be rerun in your Journey (will never get that email), but will continue to the next step.
Your best bet would be to have all the leads go into a DE and then use a newly created DE to house total sent per domain. Then use SQL to push this data via OVERWRITE into your Entry DE. This SQL would look at the count DE and if the domain is greater than 20000 for the day, then it won't push them to the send DE.
DE 1: Collection DE
yourPrimaryKey(s) | yourRequireFields | Domain | Sent
Domain - To reference for DE 2
Sent - To determine if the row has already been processed
DE 2: Domain Count DE
Domain (primary Key) | Count
Domain - Key for reference of Domain in filter
Count - total number emails sent to that domain so far
DE 3: Your sending DE
There are no special fields needed here. Just use what you need.
Query 1: Total Sent
SELECT Domain, COUNT(*) as Count FROM SendLog GROUP BY Domain if you use a Send Log. If you do not, you will need to use the Sent Dataview - which will slow your performance.
Query 2: Move Collection DE records to Sending DE
SELECT cde.yourFields FROM CollectionDE cde WHERE cde.Domain NOT IN (SELECT Domain FROM DomainCountDE WHERE Count < 20000) (I am sure there are more efficient ways to write it, but this is quick example)
Inside of your email you would need to put some AMPScript to add in the 'Sent' field of the Collection DE so that we know it was already processed.
UPSERTDE(collectionDE, yourPrimaryKeys, @yourPrimaryKeyValues, "Sent", "Y")
You would then just have your Sending DE be the one attached to the journey and this will filter out all the already sent ones and it will also stop sending to domains once they reach 20000. You would just need to make sure these queries run hourly prior to your entry source.
There are better solutions to this, but they would require more development. Such as utilizing API Entry events, creating AMPScript or SSJS app via Script Activities, etc. That may be more elegant and comprehensive. But this is one of the simplest ways to implement without altering much of what you already have built.