377.4. 메시지 사용


Yammer 구성 요소는 메시지를 사용 하기 위해 여러 끝점을 제공 합니다.

URI설명
 yammer:messages?[options]

사용자의 모든 공개 메시지(API를 호출하는 데 액세스 토큰이 사용되고 있음) Yammer 네트워크입니다. Yammer 웹 인터페이스의 "모든" 대화에 해당합니다.

 yammer:my_feed?[options]

사용자의 피드는 "Following"과 "Top" 대화 중에서 선택한 항목을 기반으로 합니다.

yammer:algo?[options]

대부분의 사용자가 Yammer 웹 인터페이스에서 볼 수있는 "Top" 대화에 해당하는 사용자에 대한 알고리즘 피드입니다.

yammer:following?[options]

사용자가 따르고 있는 사람, 그룹 및 주제와 관련된 "다음" 피드입니다.

yammer:sent?[options]

사용자가 보낸 모든 메시지

yammer:private?[options]

사용자가 수신한 개인 메시지입니다.

yammer:received?[options]

Camel 2.12.1: 사용자가 수신한 모든 메시지

377.4.1. 메시지 형식

기본적으로 모든 메시지는 org.apache.camel.component.yammer.model 패키지에 제공된 POJO 모델로 변환됩니다. yammer의 원래 메시지는 JSON에 있습니다. 끝점을 사용하고 끝점을 생성하는 모든 메시지에 대해 messages 오브젝트가 반환됩니다. 예를 들어 다음과 같은 경로를 사용합니다.

from("yammer:messages?consumerKey=aConsumerKey&consumerSecret=aConsumerSecretKey&accessToken=aAccessToken")
    .to("mock:result");

yammer 서버가 반환한 것을 알 수 있습니다.

{
    "messages":[
        {
            "replied_to_id":null,
            "network_id":7654,
            "url":"https://www.yammer.com/api/v1/messages/305298242",
            "thread_id":305298242,
            "id":305298242,
            "message_type":"update",
            "chat_client_sequence":null,
            "body":{
                "parsed":"Testing yammer API...",
                "plain":"Testing yammer API...",
                "rich":"Testing yammer API..."
            },
            "client_url":"https://www.yammer.com/",
            "content_excerpt":"Testing yammer API...",
            "created_at":"2013/06/25 18:14:45 +0000",
            "client_type":"Web",
            "privacy":"public",
            "sender_type":"user",
            "liked_by":{
                "count":1,
                "names":[
                    {
                        "permalink":"janstey",
                        "full_name":"Jonathan Anstey",
                        "user_id":1499642294
                    }

                ]

            },
            "sender_id":1499642294,
            "language":null,
            "system_message":false,
            "attachments":[

            ],
            "direct_message":false,
            "web_url":"https://www.yammer.com/redhat.com/messages/305298242"
        },
        {
            "replied_to_id":null,
            "network_id":7654,
            "url":"https://www.yammer.com/api/v1/messages/294326302",
            "thread_id":294326302,
            "id":294326302,
            "message_type":"system",
            "chat_client_sequence":null,
            "body":{
                "parsed":"(Principal Software Engineer) has [[tag:14658]] the redhat.com network. Take a moment to welcome Jonathan.",
                "plain":"(Principal Software Engineer) has #joined the redhat.com network. Take a moment to welcome Jonathan.",
                "rich":"(Principal Software Engineer) has #joined the redhat.com network. Take a moment to welcome Jonathan."
            },
            "client_url":"https://www.yammer.com/",
            "content_excerpt":"(Principal Software Engineer) has #joined the redhat.com network. Take a moment to welcome Jonathan.",
            "created_at":"2013/05/10 19:08:29 +0000",
            "client_type":"Web",
            "sender_type":"user",
            "privacy":"public",
            "liked_by":{
                "count":0,
                "names":[

                ]

            }
        }
        ]

    }

Camel은 2개 Message 개체를 포함하는 messages 오브젝트로 마샬링합니다. 아래 그림과 같이 필요한 정보를 쉽게 얻을 수 있는 풍부한 개체 모델이 있습니다.

Exchange exchange = mock.getExchanges().get(0);
Messages messages = exchange.getIn().getBody(Messages.class);

assertEquals(2, messages.getMessages().size());
assertEquals("Testing yammer API...", messages.getMessages().get(0).getBody().getPlain());
assertEquals("(Principal Software Engineer) has #joined the redhat.com network. Take a moment to welcome Jonathan.", messages.getMessages().get(1).getBody().getPlain());

즉, 이 데이터를 POJO로 마샬링하는 것은 무료가 아니므로 URI에 useJson=false 옵션을 추가하여 순수 JSON을 사용하여 다시 전환할 수 있습니다.

Red Hat logoGithubRedditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

© 2024 Red Hat, Inc.