Top Description Constructors Methods
reactor.netty.contextpropagation

public final Class ChannelContextAccessor

extends Object
implements ContextAccessor<Channel, Channel>
Class Inheritance
All Implemented Interfaces
io.micrometer.context.ContextAccessor
Imports
io.micrometer.context.ContextAccessor, io.netty.channel.Channel, reactor.util.annotation.Nullable, reactor.util.context.Context, .ContextView, java.util.Map, java.util.function.Predicate

A ContextAccessor to enable reading values from a Netty Channel and writing values to a Netty Channel.

Note

This public class implements the io.micrometer:context-propagation SPI library, which is an optional dependency.

Author
Violeta Georgieva
Since
1.0.26

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Class<? extends Channel>
readableType()

Implements io.micrometer.context.ContextAccessor.readableType.

Class representing the type of context this accessor is capable of reading values from.
public <T> T
readValue(Channel
the context to read from; the context type should be assignable from the type returned by readableType().
sourceContext
,
Object
the key to use to look up the context value
key
)

Implements io.micrometer.context.ContextAccessor.readValue.

Read a single value from the source context.
public void
readValues(Channel
the context to read from; the context type should be assignable from the type returned by readableType().

When an ContextAccessor is used to populate a ContextSnapshot, the snapshot implementations are required to filter out null mappings, so it is not required to implement special handling in the accessor.

sourceContext
,
Predicate<Object>
a predicate to decide which keys to read
keyPredicate
,
Map<Object, Object>
a map where to put read values
readValues
)

Implements io.micrometer.context.ContextAccessor.readValues.

Read values from a source context into a Map.
public Class<? extends Channel>
writeableType()

Implements io.micrometer.context.ContextAccessor.writeableType.

Class representing the type of context this accessor can restore values to.
public Channel
writeValues(Map<Object, Object>
the values to write to the target context.
valuesToWrite
,
Channel
the context to write to; the context type should be assignable from the type returned by writeableType().
targetContext
)

Implements io.micrometer.context.ContextAccessor.writeValues.

Write values from a Map to a target context.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ChannelContextAccessorback to summary
public ChannelContextAccessor()

Method Detail

readableTypeback to summary
public Class<? extends Channel> readableType()

Implements io.micrometer.context.ContextAccessor.readableType.

Doc from io.micrometer.context.ContextAccessor.readableType.

Class representing the type of context this accessor is capable of reading values from.

Annotations
@Override
readValueback to summary
public <T> T readValue(Channel sourceContext, Object key)

Implements io.micrometer.context.ContextAccessor.readValue.

Doc from io.micrometer.context.ContextAccessor.readValue.

Read a single value from the source context.

Parameters
sourceContext:Channel

the context to read from; the context type should be assignable from the type returned by readableType().

key:Object

the key to use to look up the context value

Returns:T

the value, if present

Annotations
@Override
@Nullable
@SuppressWarnings:TypeParameterUnusedInFormals
readValuesback to summary
public void readValues(Channel sourceContext, Predicate<Object> keyPredicate, Map<Object, Object> readValues)

Implements io.micrometer.context.ContextAccessor.readValues.

Doc from io.micrometer.context.ContextAccessor.readValues.

Read values from a source context into a Map.

Parameters
sourceContext:Channel

the context to read from; the context type should be assignable from the type returned by readableType().

When an ContextAccessor is used to populate a ContextSnapshot, the snapshot implementations are required to filter out null mappings, so it is not required to implement special handling in the accessor.

keyPredicate:Predicate<Object>

a predicate to decide which keys to read

readValues:Map<Object, Object>

a map where to put read values

Annotations
@Override
writeableTypeback to summary
public Class<? extends Channel> writeableType()

Implements io.micrometer.context.ContextAccessor.writeableType.

Doc from io.micrometer.context.ContextAccessor.writeableType.

Class representing the type of context this accessor can restore values to.

Annotations
@Override
writeValuesback to summary
public Channel writeValues(Map<Object, Object> valuesToWrite, Channel targetContext)

Implements io.micrometer.context.ContextAccessor.writeValues.

Doc from io.micrometer.context.ContextAccessor.writeValues.

Write values from a Map to a target context.

Parameters
valuesToWrite:Map<Object, Object>

the values to write to the target context.

targetContext:Channel

the context to write to; the context type should be assignable from the type returned by writeableType().

Returns:Channel

a context with the written values

Annotations
@Override