class ActiveSupport::Messages::Metadata

def extract_metadata(message)

def extract_metadata(message)
  data = JSON.decode(message) rescue nil
  if data.is_a?(Hash) && data.key?("_rails")
    new(decode(data["_rails"]["message"]), data["_rails"]["exp"], data["_rails"]["pur"])
  else
    new(message)
  end
end