function handleMqTracingHeaders(headers, segment, transportType, transaction) {
  // TODO: replace functionality when CAT fully removed.

  if (!headers) {
    this.logger.debug('No headers for CAT or DT processing.')
    return
  }

  const config = this.agent.config

  if (!config.cross_application_tracer.enabled && !config.distributed_tracing.enabled) {
    this.logger.trace('CAT and DT disabled, not extracting headers.')
    return
  }

  // Check that we're in an active transaction.
  const currentSegment = segment || this.getSegment()
  transaction = transaction || this.tracer.getTransaction()
  if (!currentSegment || !transaction.isActive()) {
    this.logger.trace('Not processing headers for CAT or DT, not in an active transaction.')
    return
  }

  if (config.distributed_tracing.enabled) {
    transaction.acceptDistributedTraceHeaders(transportType, headers)
    return
  }

  // Not DT so processing CAT.
  // TODO: Below will be removed when CAT removed.
  const { appData, id, transactionId } = cat.extractCatHeaders(headers)
  const { externalId, externalTransaction } = cat.parseCatData(
    id,
    transactionId,
    config.encoding_key
  )
  cat.assignCatToTransaction(externalId, externalTransaction, transaction)
  const decodedAppData = cat.parseAppData(config, appData)
  cat.assignCatToSegment({ appData: decodedAppData, segment: currentSegment, transaction })
  // TODO: Handle adding ExternalTransaction metrics for this segment.
}
Retrieves whatever CAT headers may be in the given headers.

- `handleMqTracingHeaders(headers [, segment ] [, transportType], [, transaction])`

@memberof TransactionShim.prototype

This will check for either header naming style, and both request and reply
CAT headers.
@param {object} headers
 The request/response headers object to look in.
@param {TraceSegment} [segment]
 The trace segment to associate the header data with. If no segment is
 provided then the currently active segment is used.
@param {string} [transportType]
 The transport type that brought the headers. Usually `HTTP` or `HTTPS`.
@param {Transaction} transaction active transaction