class MessageParser {

  @Nullable static String channelName(@Nullable Destination destination) {
    if (destination == null) return null;
    boolean isQueue = isQueue(destination);
    try {
      if (isQueue) {
        return ((Queue) destination).getQueueName();
      } else {
        return ((Topic) destination).getTopicName();
      }
    } catch (Throwable t) {
      propagateIfFatal(t);
      log(t, "error getting destination name from {0}", destination, null);
    }
    return null;
  }

}