Twitter 検索リクエストを発行し、各ツイートをループし、ターゲット コネクタ (ファイル、jdbc など) にプッシュするフローを作成しています。フローの複数のステップで使用したい user.screenName、text、id などのプロパティがあります。DataWeave がなければ、私の最初の反応は、Message Properties 変換ステップを使用して flowVars を設定することです。
私の質問は、次の Json ペイロードについて、フローのスコープ全体で変数を活用できるように、DataWeave で flowVar を設定するより洗練された方法があるかということです。それとも、引き続き Message Properties 変換ステップを利用して flowVars を設定する必要がありますか?
Twitter 応答 JSON:
{
"sinceId": 0,
"maxId": 677174121147604994,
"refreshUrl": "?since_id=677174121147604994&q=%23MuleSoft&include_entities=1",
"count": 1,
"completedIn": 0.034,
"query": "#MuleSoft",
"tweets": [
{
"createdAt": 1450285866000,
"id": 677174121147604994,
"text": "Connectivity Benchmark Report | New opportunities in #DigitalEra #MuleSoft https://t.co/bmHKJAkTy1",
"source": "<a href=\"http://www.hootsuite.com\" rel=\"nofollow\">Hootsuite</a>",
"inReplyToStatusId": -1,
"inReplyToUserId": -1,
"inReplyToScreenName": null,
"geoLocation": null,
"place": null,
"retweetCount": 0,
"retweetedStatus": null,
"userMentionEntities": [],
"hashtagEntities": [
{
"start": 53,
"end": 64,
"text": "DigitalEra"
},
{
"start": 65,
"end": 74,
"text": "MuleSoft"
}
],
"mediaEntities": [],
"currentUserRetweetId": -1,
"user": {
"id": 228823277,
"name": "Nitor Group Ltd.",
"screenName": "nitorgroup",
"location": "Washington, DC",
"description": "Connecting the whole world of healthcare with standards-based solutions. #Direct #SecureMessaging #HealthBus #Interoperability #MovingMedicalRecords #HealthIT",
"descriptionURLEntities": [],
"profileImageUrlHttps": "https://pbs.twimg.com/profile_images/1195068249/Nitor_Logo_128x128_normal.jpg",
"url": "http://t.co/FTsfFWQcsw",
"followersCount": 364,
"status": null,
"profileBackgroundColor": "1A1B1F",
"profileTextColor": "666666",
"profileLinkColor": "F19E4F",
"profileSidebarFillColor": "333333",
"profileSidebarBorderColor": "000000",
"profileUseBackgroundImage": true,
"showAllInlineMedia": false,
"friendsCount": 1371,
"createdAt": 1292873952000,
"favouritesCount": 2,
"utcOffset": -18000,
"timeZone": "Eastern Time (US & Canada)",
"profileBackgroundImageUrl": "http://pbs.twimg.com/profile_background_images/323688620/nitor_twitter_bkgd.jpg",
"profileBackgroundImageUrlHttps": "https://pbs.twimg.com/profile_background_images/323688620/nitor_twitter_bkgd.jpg",
"profileBackgroundTiled": false,
"lang": "en",
"statusesCount": 305,
"translator": false,
"listedCount": 15,
"protected": false,
"contributorsEnabled": false,
"profileImageURL": "http://pbs.twimg.com/profile_images/1195068249/Nitor_Logo_128x128_normal.jpg",
"biggerProfileImageURL": "http://pbs.twimg.com/profile_images/1195068249/Nitor_Logo_128x128_bigger.jpg",
"miniProfileImageURL": "http://pbs.twimg.com/profile_images/1195068249/Nitor_Logo_128x128_mini.jpg",
"originalProfileImageURL": "http://pbs.twimg.com/profile_images/1195068249/Nitor_Logo_128x128.jpg",
"profileImageURLHttps": "https://pbs.twimg.com/profile_images/1195068249/Nitor_Logo_128x128_normal.jpg",
"biggerProfileImageURLHttps": "https://pbs.twimg.com/profile_images/1195068249/Nitor_Logo_128x128_bigger.jpg",
"miniProfileImageURLHttps": "https://pbs.twimg.com/profile_images/1195068249/Nitor_Logo_128x128_mini.jpg",
"originalProfileImageURLHttps": "https://pbs.twimg.com/profile_images/1195068249/Nitor_Logo_128x128.jpg",
"geoEnabled": true,
"profileBackgroundImageURL": "http://pbs.twimg.com/profile_background_images/323688620/nitor_twitter_bkgd.jpg",
"profileBannerURL": null,
"profileBannerRetinaURL": null,
"profileBannerIPadURL": null,
"profileBannerIPadRetinaURL": null,
"profileBannerMobileURL": null,
"profileBannerMobileRetinaURL": null,
"verified": false,
"followRequestSent": false,
"urlentity": {
"start": 0,
"end": 22,
"url": "http://t.co/FTsfFWQcsw",
"expandedURL": "http://nitorgroup.com",
"displayURL": "nitorgroup.com"
},
"accessLevel": 0,
"rateLimitStatus": null
},
"truncated": false,
"urlentities": [
{
"start": 75,
"end": 98,
"url": "https://t.co/bmHKJAkTy1",
"expandedURL": "http://ow.ly/VSHvk",
"displayURL": "ow.ly/VSHvk"
}
],
"favorited": false,
"retweet": false,
"retweetedByMe": false,
"possiblySensitive": false,
"contributors": [],
"accessLevel": 0,
"rateLimitStatus": null
}],
"refreshURL": "?since_id=677174121147604994&q=%23MuleSoft&include_entities=1",
"accessLevel": 2,
"rateLimitStatus": {
"remaining": 179,
"limit": 180,
"resetTimeInSeconds": 1450293371,
"secondsUntilReset": 899,
"remainingHits": 179
}
}
データウィーブ:
%dw 1.0
%output application/json
---
{
screenName: payload.user.screenName,
tweetId: payload.id,
tweetText: payload.text
}