Expand | |||
---|---|---|---|
| |||
|
...
|
...
|
...
|
...
|
...
|
...
|
Messages
Code Block | ||
---|---|---|
| ||
## Message options for message classes/modules
def priority
0
end
def expiration
nil
end
def type
'task'
end
def validate
@valid = true
end
def message
@options
end
def exchange_name
lex = self.class.ancestors.first.to_s.split('::')[2].downcase
"Legion::Extensions::#{lex.capitalize}::Transport::Exchanges::#{lex.capitalize}"
end
def exchange
Kernel.const_get(exchange_name)
end
def encrypt?
false
end |
You can set priority to allow for messages to be processed with priority over lower priority messages priority docs
Message TTL. Message will expire after this many milliseconds message ttl docs
Add custom logic including raising exceptions to make sure your message has what it needs
You can override the message payload
The encrypt? method will automatically encrypt messages with the cluster-secret. If you are using the Subscription actor, it will automatically decrypt the payload based on the content-encoding header