# File lib/mcollective/connector/activemq.rb, line 512
      def headers_for(msg, identity=nil)
        headers = {}

        headers = {"priority" => @msgpriority} if @msgpriority > 0

        headers["timestamp"] = (Time.now.utc.to_i * 1000).to_s

        # set the expires header based on the TTL, we build a small additional
        # timeout of 10 seconds in here to allow for network latency etc
        headers["expires"] = ((Time.now.utc.to_i + msg.ttl + 10) * 1000).to_s

        if [:request, :direct_request].include?(msg.type)
          target = make_target(msg.agent, :reply, msg.collective)

          if msg.reply_to
            headers["reply-to"] = msg.reply_to
          else
            headers["reply-to"] = target[:name]
          end

          headers["mc_identity"] = identity if msg.type == :direct_request
        end

        headers["mc_sender"] = Config.instance.identity

        return headers
      end