I have created a Proxy Service in pipeline I wanted to transform the incoming xml to some other structure. Like
<body>
<prices>
<price>$100</price>
</prices>
<prices>
<price>E100</price>
</prices>
</body>
Should be transformed to
<body>
<prices>
<price>$100</price>
<type>USD</type>
</prices>
<prices>
<price>E100</price>
<type>UERO</type>
</prices>
</body>
From the pipline stage I have selected Add Action -> Flow Control -> For Each
And I have selected body/prices/* in the Xquery builder.
Butt none of the prices tag are processed.
I get "with total count in variable " totalCount is zero always.
select body/prices/price instead of body/prices/*
Related
I want Google Analytics to send a client calculated value on AMP. I also use Google Tag Manager to embed analytics code on the page.
I want to send a value that is the difference between a time (unix) and current time on device. There's a variable on Tag Manager named "{{Client Timestamp}}" and I define server side the other date. But any time I send the value, get's turned to string (no matter if it's custom metric or custom dimension), for instance:
cm3: 1582720980844-1582641262000
Do you know any way I can achieve this? Also tried with a generated hidden element with the value calculated, but I can't manage the set the correct value on this element without user interaction.
<amp-state id="my_data">
<script type="application/json">
{
"my_date": SERVER_GENERATED_TIMESTAMP
}
</script>
</amp-state>
<span class="element_to_send_from_tag_manager" [text]="Date.now() - my_date">sample value</span>
You are trying to make a calculation inside a text field, that's why GTM is treating it as a string no matter what you do. If you want to run a calculation that is the difference of time between those two variables, use a custom javascript variable and push the result of that inside your secondary dimension.
Example of custom JS variable in GTM:
function() {
var result = {{variable1}} - {{variable2}};
return result;
}
EDIT:
Since we are talking about an AMP container, we cannot do the subtraction inside GTM itself, what we can use instead is the Calculated Metrics functionality inside GA itself.
How can I pass 2 OTA_AirPriceRQ in 1 EnhancedAirBookRQ for booking RoundTrip in Sabre?
Consider the below example:
<EnhancedAirBookRQ>
<OTA_AirBookRQ>
...
<FlightSegment>
<!-- Segment 1 Details -->
<FlightSegment/>
<FlightSegment>
<!-- Segment 2 Details -->
<FlightSegment/>
<OTA_AirPriceRQ>
<PriceRequestInformation>
<OptionalQualifiers>
<PricingQualifiers CurrencyCode='INR'>
<PassengerType Code='ADT' Force='true' Quantity='1'/>
</PricingQualifiers>
</OptionalQualifiers>
</PriceRequestInformation>
</OTA_AirPriceRQ>
<PostProcessing IgnoreAfter="false">
<RedisplayReservation/>
</PostProcessing>
<EnhancedAirBookRQ>
So from above code,I wanted to pass another OTA_AirPriceRQ for Segment 2, to achieve RoundTrip.
But I get error when I repeat OTA_AirPriceRQ Tag.
Try with SegmentSelect element under PriceRequestInformation/OptionalQualifiers/PricingQualifiers/ItineraryOptions.
By default, all segments will be priced the same way, so unless you want to do something special for particular segment/s, you don't need to add extra qualifiers.
OTA_AirPriceRQ is used to get pricing information (price breakdown) for a specific travel, however travel details (origin, destination, classes, flight numbers, etc) you have to provide in OTA_AirBookRQ. It's a part of a EnhancedAirBookRQ transaction you are using (but should be defined prior to OTA_AirPriceRQ in request xml)
To sum it up - when you provide in OTA_AirBookRQ information about outbound and inbound flight, then 1 OTA_AirPriceRQ returns you full pricing information (no seperate AirPriceRQ is required)
You can find more information here
https://developer.sabre.com/docs/read/soap_apis/air/book/orchestrated_air_booking
I have this following mediation flow in wso2 ESB for a client.
Sequence 1
Call data service
Check data availability
if available
Get data using data service
Manipulate data using payload factory
Iterate based on node
send data to client
get response
create payload based on response to data service
update database
end iterate
end if
end
Similar to the sequence 1, I have sequence 2, sequence 3.. sequence n calling different data services and different client endpoints. Sequence 1 works correctly, fetching data and updating the database. When the flow goes to sequence 2, while logging, I can see the contents/messages from sequence 1 found in sequence 2 which causes the sequence 2 perform erroneously. My question is, is there a way to like a java flush(), close() from moving from sequence 1 to sequence 2 in the wso2 ESB.
Thanks in advance.
Solution 1: You can use the clone mediator to create multiple instances of your message content.
Solution 2: Another possibility is to store the initial content (before sequence1 starts) in a and update the initial content again before sequence2 start. Use the enrich mediator for this.
As the clone mediator is not recommended (creates new threads!), I would go for the second solution with the enrich mediator.
<!-- store the initial message content -->
<enrich>
<source type="body" clone="true"/>
<target type="property" property="BodyBackup"/>
</enrich>
<sequence key="sequence1"/>
<!-- restore the message content -->
<enrich>
<source type="property" property="BodyBackup"/>
<target type="body"/>
</enrich>
<sequence key="sequence2"/>
Using Google Tag Manager, I use a variable in order to know the location of my application. Every time the user changes the section, a JS code pushes a new value to the 'location' variable, like this:
(function() {
dataLayerGoogleTagManager.push({'location': 'tools'});
})();
My problem comes when I check the Data Layer, it duplicates the variable 'location' with many different values. Debugging in the console:
Obviously, when I try to get the value of 'location', the result is not what I want.
Do you know how to fix this?
Thank you for any help you can provide
This is ok - all datalayer variables act display like this in the console - when they're updated their value changes.
If you use the GTM macro to read the value then it will always take the latest one.
I use an html tag like this to show what my current macro values are for debugging purposes:
<script>
console.log("*** GTM Debugging to Console ***");
console.log("GTM event fired: " + {{event}});
console.log("Debug mode: " + {{debug mode}});
console.log("Location: " + {{location}});
</script>
Create a macro for location and you can view it's current value with this tag.
Set the tag rule to be for any event you want to debug, or alternatively set it for all pages and block it with a rule for debug = false, then it will only show in debug mode.
I am using graphite with statsd to collect various pieces of data from an application I have clustered in ec2. Among other things I have statistics for messages delivered by by application ond those that failed delivery. Because the number of consumers of messages of my application is somewhat fluid (changes every few days) I would like to be able to dynamicaaly generate graphs for these two stats per consumer. I post messages to statsd/graphite with the consumer id that is generated by the system as part of the stat:
stats.myapp.consumers.<consumerId>.messagesDelivered
stats.myapp.consumers.<consumerId>.messagesFailed
I currently generate two graphs using the wildcard for the consumerId:
stats.myapp.consumers.*.messagesDelivered
stats.myapp.consumers.*.messagesFailed
This is ok for a few consumers but I currently have >300 and it is growing rapidly. What I would like to be able to do is pass the above targets (or similar) and have graphite return a graph for each unique id. (I say graph but I am actually getting json results) I am currently using a personally modified version of the giraffe dashboard but am open to other suggestions.
Is this something that is even possible? (I suppose I could write some custom code to retrieve each id then generate the requests for each one each time. But I would really like to keep my customizations minimal if possible.)
I'm sure it's likely I will need to provide more details. Please let me know what you would need to know or if I am possibly just off-base with my request.
More details:
So, the end result of what I am hoping for is not to have one graph with, for lack of a better term, 300 lines each representing a node. I would like to have one graph for each node, each with two lines. One for delivered messages and one for failed messages.
When I attempted the solution from #Matt Self I ended-up with one graph with 300 lines on it. (Or, maybe I misinterpreted the suggestion?)
If I understand you correctly, I believe you can use groupByNode to do what you want:
groupByNode(stats.myapp.consumers.*.messagesDelivered,3,"sumSeries")
The 3 is used to indicate the unique id part of the bucket (e.g. stats=0,myapp=1,consumers=2,uniqueid=3,etc). And I used the sumSeries as the callback function in the example above, which it seems like might work for you, but you'll have to ensure you choose a function that makes sense for any series data you get per a unique id.
groupByNode used in this way (with the wildcard for the unique id) will return separate targets with datapoints for (grouped-by) each uniqueid.
Update based on comments:
While the above will create one rendered graph image with many graphs/lines based on a single input "target", the OP wants to create multiple independent graph images based on one input:
I don't know of a way render multiple graphs from the graphite url api (i.e. using graphite alone). Perhaps there is something in the dashboard that will accomplish it.
That said, you could do this with some simple html + javascript. Something like this might work (but you might have to tweak it):
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Multi-graph</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
var graphite_render_url = "http://some.graphite.host.blah.com/render/";
var mainTarget = "stats.myapp.consumers.*.messagesDelivered";
var mainFunc = "sumSeries";
var url = graphite_render_url + "?target=groupByNode(" + mainTarget + ",3,\"" + mainFunc + "\")";
url = url + "&format=json&jsonp=?";
$.getJSON(url, function(data){
for (var i = data.length - 1; i >= 0; i--) {
console.log(data[i]);
var imgSrc = graphite_render_url + "?target=";
var imgActual = mainTarget.replace('*',data[i].target);
$('#imagesList').append('<img src="' + imgSrc + imgActual + '" />');
};
});
</script>
</head>
<body>
<div id="imagesList"></div>
</body>
</html>
The above would insert an image for every unique returned target. This might not be exactly what you are looking for, but might get you headed down a working path.