| 89 | } |
| 90 | |
| 91 | func (f *HttpTubeFactory) Handle(ctx context.Context, endpoint string, record Record) error { |
| 92 | e, ok := f.getEndpoint(endpoint) |
| 93 | if !ok { |
| 94 | return ErrEndpointNotFound |
| 95 | } |
| 96 | if e.s.Load() == stateClosed { |
| 97 | return ErrEndpointClosed |
| 98 | } |
| 99 | select { |
| 100 | case e.c <- record: |
| 101 | return nil |
| 102 | case <-ctx.Done(): |
| 103 | return ctx.Err() |
| 104 | case <-e.ctx.Done(): |
| 105 | return ErrEndpointClosed |
| 106 | } |
| 107 | } |
| 108 | |
| 109 | func (f *HttpTubeFactory) NewSourceTube(ctx context.Context, config ConfigMap) (<-chan Record, error) { |
| 110 | c := httpSourceTubeConfig{} |