1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
use crate::options::retry::RetryOptions;
use crate::{Position, StreamPosition, SubscriptionFilter};
use eventstore_macros::{options, streaming};
options! {
#[derive(Clone)]
#[streaming]
pub struct SubscribeToAllOptions {
pub(crate) position: StreamPosition<Position>,
pub(crate) resolve_link_tos: bool,
pub(crate) filter: Option<SubscriptionFilter>,
pub(crate) retry: Option<RetryOptions>,
}
}
impl Default for SubscribeToAllOptions {
fn default() -> Self {
Self {
filter: None,
position: StreamPosition::Start,
resolve_link_tos: false,
retry: None,
common_operation_options: Default::default(),
}
}
}
impl SubscribeToAllOptions {
/// Starting point in the transaction journal log. By default, it will start at
/// `StreamPosition::Start`
pub fn position(self, position: StreamPosition<Position>) -> Self {
Self { position, ..self }
}
/// Filters events or streams based upon a predicate.
pub fn filter(self, filter: SubscriptionFilter) -> Self {
Self {
filter: Some(filter),
..self
}
}
/// When using projections, you can have links placed into another stream.
/// If you set `true`, the server will resolve those links and will return
/// the event that the link points to. Default: [NoResolution](../types/enum.LinkTos.html).
pub fn resolve_link_tos(self) -> Self {
Self {
resolve_link_tos: true,
..self
}
}
/// When a disconnection happens, automatically resubscribe to stream changes. When enabled,
/// The client will keep track of the current subscription offset.
pub fn retry_options(self, options: RetryOptions) -> Self {
Self {
retry: Some(options),
..self
}
}
}