Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a sync client #7934

Merged
merged 1 commit into from
Aug 10, 2018
Merged

Add a sync client #7934

merged 1 commit into from
Aug 10, 2018

Conversation

ph
Copy link
Contributor

@ph ph commented Aug 9, 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

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
```
@urso urso merged commit 7bc8442 into elastic:feature/beatless Aug 10, 2018
@ph ph removed the in progress Pull request is currently in progress. label 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 to ph/beats that referenced this pull request Sep 10, 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
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants