code: public String resolveEndpointUri(Message message, String defaultName) {
          Map<String, Object> headers = message.getHeaders();
  
          String destinationName;
          if (headers.containsKey(DESTINATION_HEADER_NAME)) {
              destinationName = headers.get(DESTINATION_HEADER_NAME).toString();
          } else if (StringUtils.hasText(defaultName)) {
              destinationName = defaultName;
          } else {
              destinationName = defaultDestinationName;
          }
  
          if (destinationName == null) {
              throw new CitrusRuntimeException("Unable to resolve dynamic destination name! Neither header entry '" +
                      DESTINATION_HEADER_NAME + "' nor default destination name is set");
          }
  
          return destinationName;
      }
docs: Get the endpoint uri according to message header entry with fallback default uri.