22 lines
373 B
Go
22 lines
373 B
Go
|
// -*- Mode: Go; indent-tabs-mode: t -*-
|
||
|
//
|
||
|
// Copyright (C) 2019-2021 IOTech Ltd
|
||
|
//
|
||
|
// SPDX-License-Identifier: Apache-2.0
|
||
|
|
||
|
package correlation
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
|
||
|
"github.com/edgexfoundry/go-mod-core-contracts/v4/common"
|
||
|
)
|
||
|
|
||
|
func IdFromContext(ctx context.Context) string {
|
||
|
hdr, ok := ctx.Value(common.CorrelationHeader).(string)
|
||
|
if !ok {
|
||
|
hdr = ""
|
||
|
}
|
||
|
return hdr
|
||
|
}
|