-
-
Notifications
You must be signed in to change notification settings - Fork 363
Message compression and encryption
By default, Rebus uses the built-in JSON serializer which internally uses the excellent Newtonsoft JSON.NET. The Newtonsoft DLL is Ilmerged into Rebus, so as to not bother you by that dependency.
Rebus supports automatic encryption of message bodies, which means that the contents of messages cannot easily be read by eavesdroppers. This can be useful if you're e.g. sending messages containing payroll information, or other kinds of information that should not be readily readable.
You can enable encryption by going:
Configure.With(...)
.(...)
.Decorators(d => d.EncryptMessageBodies("base 64 encoded encryption key"))
.(...)
or
Configure.With(...)
.(...)
.Decorators(d => d.EncryptMessageBodies())
.(...)
to pick up the key from the current app.config. In case you forget to provide a valid key, Rebus is nice enough to generate one for you that you may copy into your configuration file and start using :) Rebus will used the built-in functionality in .NET to generate the key.
Since many serialization formats are pretty verbose, and JSON in that regard is probabably one of the most verbose formats because it includes the entire schema along with every single message, you may want to enable message compression.
In order to enable compression, you can do this:
Configure.With(...)
.(...)
.Decorators(d => d.CompressMessageBodies(512))
.(...)
in order to compress messages whose raw byte[]
payload exceeds 512 bytes in length, or
Configure.With(...)
.(...)
.Decorators(d => d.CompressMessageBodies())
.(...)
in order to use the default threshold of 2048 bytes.
You can, of course, combine both encryption and compression, by going
Configure.With(...)
.(...)
.Decorators(d => {
d.EncryptMessageBodies();
d.CompressMessageBodies();
})
.(...)
Since encryption scrambles messages badly, Rebus will of course compress messages before they're encrypted when sending, and in reverse upon receiving them, no matter how you configure it.
Basic stuff
- Home
- Introduction
- Getting started
- Different bus modes
- How does rebus compare to other .net service buses?
- 3rd party extensions
- Rebus versions
Configuration
Scenarios
Areas
- Logging
- Routing
- Serialization
- Pub sub messaging
- Process managers
- Message context
- Data bus
- Correlation ids
- Container adapters
- Automatic retries and error handling
- Message dispatch
- Thread safety and instance policies
- Timeouts
- Timeout manager
- Transactions
- Delivery guarantees
- Idempotence
- Unit of work
- Workers and parallelism
- Wire level format of messages
- Handler pipeline
- Polymorphic message dispatch
- Persistence ignorance
- Saga parallelism
- Transport message forwarding
- Testing
- Outbox
- Startup/shutdown
Transports (not a full list)
Customization
- Extensibility
- Auto flowing user context extensibility example
- Back off strategy
- Message compression and encryption
- Fail fast on certain exception types
Pipelines
- Log message pipelines
- Incoming messages pipeline
- Incoming step context
- Outgoing messages pipeline
- Outgoing step context
Prominent application services