Add a sync client#7934
Merged
urso merged 1 commit intoelastic:feature/beatlessfrom Aug 10, 2018
ph:feature/sync-client-wg
Merged
Add a sync client#7934urso merged 1 commit intoelastic:feature/beatlessfrom ph:feature/sync-client-wg
urso merged 1 commit intoelastic:feature/beatlessfrom
ph:feature/sync-client-wg
Conversation
In beat each data collector need to initialize his own beat.Client to
have access to the pipeline. The current pipeline implementation is
completely asynchronous, meaning when you publish something to the
queue, you don't know if it will be send or when it will be send.
Some system like aws lambda requires to be in sync, when the method
return we expect the events to be send. This PR allow to change the
behavior to have a sync publish that leverage the pipeline callbacks.
Notes: it also changes the client interface, since publish and publishAll can
return an error.
Usage:
```
sc, err := NewSyncClient(pipeline, beat.ClientConfig{})
if !assert.NoError(t, err) {
return
}
err := sc.PublishAll()
if err != nil {
...
}
sc.Wait() // block until the publish is done.
defer sc.Close() // this call will also block
```
This was referenced Aug 9, 2018
urso
approved these changes
Aug 10, 2018
ph
added a commit
that referenced
this pull request
Aug 23, 2018
In beat each data collector need to initialize his own beat.Client to
have access to the pipeline. The current pipeline implementation is
completely asynchronous, meaning when you publish something to the
queue, you don't know if it will be send or when it will be send.
Some system like aws lambda requires to be in sync, when the method
return we expect the events to be send. This PR allow to change the
behavior to have a sync publish that leverage the pipeline callbacks.
Notes: it also changes the client interface, since publish and publishAll can
return an error.
Usage:
```
sc, err := NewSyncClient(pipeline, beat.ClientConfig{})
if !assert.NoError(t, err) {
return
}
err := sc.PublishAll()
if err != nil {
...
}
sc.Wait() // block until the publish is done.
defer sc.Close() // this call will also block
```
ph
added a commit
that referenced
this pull request
Sep 25, 2018
In beat each data collector need to initialize his own beat.Client to
have access to the pipeline. The current pipeline implementation is
completely asynchronous, meaning when you publish something to the
queue, you don't know if it will be send or when it will be send.
Some system like aws lambda requires to be in sync, when the method
return we expect the events to be send. This PR allow to change the
behavior to have a sync publish that leverage the pipeline callbacks.
Notes: it also changes the client interface, since publish and publishAll can
return an error.
Usage:
```
sc, err := NewSyncClient(pipeline, beat.ClientConfig{})
if !assert.NoError(t, err) {
return
}
err := sc.PublishAll()
if err != nil {
...
}
sc.Wait() // block until the publish is done.
defer sc.Close() // this call will also block
```
ph
added a commit
that referenced
this pull request
Sep 28, 2018
In beat each data collector need to initialize his own beat.Client to
have access to the pipeline. The current pipeline implementation is
completely asynchronous, meaning when you publish something to the
queue, you don't know if it will be send or when it will be send.
Some system like aws lambda requires to be in sync, when the method
return we expect the events to be send. This PR allow to change the
behavior to have a sync publish that leverage the pipeline callbacks.
Notes: it also changes the client interface, since publish and publishAll can
return an error.
Usage:
```
sc, err := NewSyncClient(pipeline, beat.ClientConfig{})
if !assert.NoError(t, err) {
return
}
err := sc.PublishAll()
if err != nil {
...
}
sc.Wait() // block until the publish is done.
defer sc.Close() // this call will also block
```
ph
added a commit
that referenced
this pull request
Oct 4, 2018
In beat each data collector need to initialize his own beat.Client to
have access to the pipeline. The current pipeline implementation is
completely asynchronous, meaning when you publish something to the
queue, you don't know if it will be send or when it will be send.
Some system like aws lambda requires to be in sync, when the method
return we expect the events to be send. This PR allow to change the
behavior to have a sync publish that leverage the pipeline callbacks.
Notes: it also changes the client interface, since publish and publishAll can
return an error.
Usage:
```
sc, err := NewSyncClient(pipeline, beat.ClientConfig{})
if !assert.NoError(t, err) {
return
}
err := sc.PublishAll()
if err != nil {
...
}
sc.Wait() // block until the publish is done.
defer sc.Close() // this call will also block
```
ph
added a commit
that referenced
this pull request
Oct 18, 2018
In beat each data collector need to initialize his own beat.Client to
have access to the pipeline. The current pipeline implementation is
completely asynchronous, meaning when you publish something to the
queue, you don't know if it will be send or when it will be send.
Some system like aws lambda requires to be in sync, when the method
return we expect the events to be send. This PR allow to change the
behavior to have a sync publish that leverage the pipeline callbacks.
Notes: it also changes the client interface, since publish and publishAll can
return an error.
Usage:
```
sc, err := NewSyncClient(pipeline, beat.ClientConfig{})
if !assert.NoError(t, err) {
return
}
err := sc.PublishAll()
if err != nil {
...
}
sc.Wait() // block until the publish is done.
defer sc.Close() // this call will also block
```
ph
added a commit
that referenced
this pull request
Oct 24, 2018
In beat each data collector need to initialize his own beat.Client to
have access to the pipeline. The current pipeline implementation is
completely asynchronous, meaning when you publish something to the
queue, you don't know if it will be send or when it will be send.
Some system like aws lambda requires to be in sync, when the method
return we expect the events to be send. This PR allow to change the
behavior to have a sync publish that leverage the pipeline callbacks.
Notes: it also changes the client interface, since publish and publishAll can
return an error.
Usage:
```
sc, err := NewSyncClient(pipeline, beat.ClientConfig{})
if !assert.NoError(t, err) {
return
}
err := sc.PublishAll()
if err != nil {
...
}
sc.Wait() // block until the publish is done.
defer sc.Close() // this call will also block
```
ph
added a commit
that referenced
this pull request
Oct 24, 2018
In beat each data collector need to initialize his own beat.Client to
have access to the pipeline. The current pipeline implementation is
completely asynchronous, meaning when you publish something to the
queue, you don't know if it will be send or when it will be send.
Some system like aws lambda requires to be in sync, when the method
return we expect the events to be send. This PR allow to change the
behavior to have a sync publish that leverage the pipeline callbacks.
Notes: it also changes the client interface, since publish and publishAll can
return an error.
Usage:
```
sc, err := NewSyncClient(pipeline, beat.ClientConfig{})
if !assert.NoError(t, err) {
return
}
err := sc.PublishAll()
if err != nil {
...
}
sc.Wait() // block until the publish is done.
defer sc.Close() // this call will also block
```
leweafan
pushed a commit
to leweafan/beats
that referenced
this pull request
Apr 28, 2023
In beat each data collector need to initialize his own beat.Client to
have access to the pipeline. The current pipeline implementation is
completely asynchronous, meaning when you publish something to the
queue, you don't know if it will be send or when it will be send.
Some system like aws lambda requires to be in sync, when the method
return we expect the events to be send. This PR allow to change the
behavior to have a sync publish that leverage the pipeline callbacks.
Notes: it also changes the client interface, since publish and publishAll can
return an error.
Usage:
```
sc, err := NewSyncClient(pipeline, beat.ClientConfig{})
if !assert.NoError(t, err) {
return
}
err := sc.PublishAll()
if err != nil {
...
}
sc.Wait() // block until the publish is done.
defer sc.Close() // this call will also block
```
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In beat each data collector need to initialize his own beat.Client to
have access to the pipeline. The current pipeline implementation is
completely asynchronous, meaning when you publish something to the
queue, you don't know if it will be send or when it will be send.
Some system like aws lambda requires to be in sync, when the method
return we expect the events to be send. This PR allow to change the
behavior to have a sync publish that leverage the pipeline callbacks.
Notes: it also changes the client interface, since publish and publishAll can
return an error.
Usage: