Skip to content

Instantly share code, notes, and snippets.

@manoelneto
Last active July 28, 2018 13:07
Show Gist options
  • Save manoelneto/82f1271139a7bbda905f9ceca22b6647 to your computer and use it in GitHub Desktop.
Save manoelneto/82f1271139a7bbda905f9ceca22b6647 to your computer and use it in GitHub Desktop.
def process_message message
# encontra os triggers da conta de que essa mensagem foi inserida
# primeira filtragem
triggers = find_triggers_for_client message
# um dos filtros em batch é chamar o servidor de termos booleano
triggers = filter_triggers_in_batch message, triggers
triggers = triggers.select do |trigger|
# verifica se passa nos ultimos filtros
trigger.pass_filters? message
end.each do |trigger|
# executa as ações
publish_to_actions_queue trigger, message
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment