function makeWrapConsumer({ spec, queue, destinationName, destNameIsArg }) {
  if (destNameIsArg && destinationName != null) {
    spec.destinationName = destinationName
  }
  if (queue != null) {
    spec.queue = queue
  }

  return function wrapConsumer(shim, consumer) {
    if (!shim.isFunction(consumer)) {
      return consumer
    }

    const consumerWrapper = createConsumerWrapper.call(this, { shim, consumer, spec })
    return shim.bindCreateTransaction(
      consumerWrapper,
      new specs.TransactionSpec({
        type: shim.MESSAGE,
        nest: true
      })
    )
  }
}
@private
@param {object} params to function
@param {specs.MessageSubscribeSpec} params.spec The message descriptor.
@param {string} params.queue name of queue
@param {string} params.destinationName destination of message in consume function
@param {boolean} params.destNameIsArg flag to state if destination is an argument
@returns {Function} wrapped consumer function