376.2. SnakeYAML 라이브러리에서 YAML 데이터 형식 사용

  • Object 메시지를 yaml로 전환한 후 MQSeries로 보냅니다.

    from("activemq:My.Queue")
      .marshal().yaml()
      .to("mqseries:Another.Queue");
    from("activemq:My.Queue")
      .marshal().yaml(YAMLLibrary.SnakeYAML)
      .to("mqseries:Another.Queue");
  • YAML에서 클래스를 로드할 제한

    // Creat a SnakeYAMLDataFormat instance
    SnakeYAMLDataFormat yaml = new SnakeYAMLDataFormat();
    
    // Restrict classes to be loaded from YAML
    yaml.addTypeFilters(TypeFilters.types(MyPojo.class, MyOtherPojo.class));
    
    from("activemq:My.Queue")
      .unmarshal(yaml)
      .to("mqseries:Another.Queue");