I'm currently trying to configure the Fiware Iot Broker with the Configuration Manager (NECongMan) and Fiware Orion as the context producer. I'm having a problem with the NGSI10 subscribeContext operation.
This is the request sent to the IoT Broker:
<?xml version="1.0"?>
<subscribeContextRequest>
<entityIdList>
<entityId type="Room" isPattern="false">
<id>Room1</id>
</entityId>
</entityIdList>
<attributeList>
<attribute>temperature</attribute>
</attributeList>
<reference>http://localhost:1028/accumulate</reference>
<duration>PT1H</duration>
<notifyConditions>
<notifyCondition>
<type>ONCHANGE</type>
<condValueList>
<condValue>pressure</condValue>
</condValueList>
</notifyCondition>
</notifyConditions>
<throttling>PT5S</throttling>
</subscribeContextRequest>
The IoTBroker tries to contact Orion issuing a subscribeContextRequest but the duration string is changed:
<subscribeContextRequest>
<entityIdList>
<entityId
type="Room"
isPattern="false">
<id>
Room1
</id>
</entityId>
</entityIdList>
<attributeList>
<attribute>
temperature
</attribute>
</attributeList>
<reference>
http://192.168.16.178:8080/ngsi10/notify
</reference>
<duration>
P0Y0M0DT0H59M58.157S
</duration>
<notifyConditions>
<notifyCondition>
<type>
ONCHANGE
</type>
<condValueList>
<condValue>
pressure
</condValue>
</condValueList>
</notifyCondition>
</notifyConditions>
<throttling>
PT5S
</throttling>
</subscribeContextRequest>
But Orion gives an error (invalid payload: syntax error in duration string). Do you have any idea how to resolve the issue?
For one hour, Duration parameter may be P1H instead of PT1H, according to the ISO 8601 standard format, it seems like PT is used only to avoid ambiguity between P1M for one month and PT1M for one minute.
Hope it helps
Orion 0.26.1 (the last version in the moment of writing this) doesn't support decimal values (as 58.157) for seconds in duration strings. We have created an issue about that and our plan is to have it solved by next release (0.27.0).
Not sure if modifying the way IoTBroker behaves (in order to round up/down the secons to an integer in the request it sends to Orion) would be a valid workaround... I don't know the details about IoTBroker.
EDIT: the fix to support decimal fractions in the seconds field has been just implemented in Orion in develop branch, so it will be available in the next Orion version (0.27.0). Alternatively, you could download source code and build the code to get the fix right now.
Related
I am trying to listen and consume an EMS queue message and transform it to insert into a Database using Anypoint Studio platform.
Below youn can find an example of the EMS queue message, and the structure of the target database table, as well as, the error I am getting, I cannot find anything to help me with this and would appreciate any insight on how to solve it! Thank you!
EMS Queue message: 1 Lopez, Gerardo 22/07/1994 323 Corona, San Pedro, Mexico 8177228822
Target DB Table Columns: id, first_name, last_name, birth_date, street, city, country, phone
I need to insert the appropriate data in the corresponding column and transform all characters to lower case, below you can find what I am doing right not and the error I get!
Caused by: org.mule.weave.v2.module.reader.ReaderParsingException: Unexpected character 'G' at payload#[1:4] (line:column), expected Expecting end of input but got G, while reading payload` as Json.
The same message repeats for all EMS Queue messages!
I guess that EMS means TIBCO EMS. It looks that the application is receiving a message from the TIBCO EMS queue, which is the string:
16 Gonzalez, Martin...
For some reason, DataWeave is trying to parse it like a JSON document. That is clear in the error. It fails in the G because the beginning is a number, so the parser for JSON wasn't expecting a G character there. A number by itself would be a perfectly valid JSON document.
You'll have to set the correct format for the input. If the TIBCO EMS connector is receiving the application/json from the message, it should be changed from the sending side.
If you need to force the format you can use set payload though I don't recommend to force it unless there is no other choice:
<set-payload value="#[payload]" mimeType="text/plain" >
I'm using Keycloak with an external OAuth server used as id provider.
When I try to login, Keycloak send an authentication backchannel request in which the OAuth server replies with a JWT.
When decoding that JWT, Keycloak fails with this exception
Caused by: com.fasterxml.jackson.core.JsonParseException: Numeric value (1539167070926) out of range of int
at [Source: (byte[])"{"sub":"20008203","aud":"Test-Keycloak","amr":["pwd","mobile"],"iss":"oauth","exp":1539167070926,"iat":1539163470926,"jti":"d24e5a11-1931-45a7-b77a-0c935ea40df8"}"; line: 1, column: 97]
at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1804)
at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:663)
at com.fasterxml.jackson.core.base.ParserBase.convertNumberToInt(ParserBase.java:869)
at com.fasterxml.jackson.core.base.ParserBase._parseIntValue(ParserBase.java:801)
at com.fasterxml.jackson.core.base.ParserBase.getIntValue(ParserBase.java:645)
at com.fasterxml.jackson.databind.deser.std.NumberDeserializers$IntegerDeserializer.deserialize(NumberDeserializers.java:472)
at com.fasterxml.jackson.databind.deser.std.NumberDeserializers$IntegerDeserializer.deserialize(NumberDeserializers.java:452)
at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:136)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:288)
... 80 more
It seems like the exp value is too big. Is keycloak failing to decode ? is my OAuth server sending a bad value ? What can I do to have that expiration correctly decoded ?
The fact is that since the JWT draft was published (Feb 2014) the spec has changed regarding to the "exp" timestamp. The final spec, published at May 2015, (https://www.rfc-editor.org/rfc/rfc7519#section-4.1.4) simply requires a numeric date.
So, the RFC does not dictate the width of the numeric representation, and i assume that means (from the side of an application as keycloak) that we should use a wide-enough integer (64-bit) so that we do not overflow.
This situation can become more annoying in the short future because of the Y2038 problem (a signed 32-bit integer cannot represent dates after (roughly) 19 Jan 2038)
As far as I understand, it seems like the id provider I try to use doesn't honor the JWT spec. Indeed, the JWT spec states the following
The "exp" (expiration time) claim identifies the expiration time on or after which the JWT MUST NOT be accepted for processing. The processing of the "exp" claim requires that the current date/time MUST be before the expiration date/time listed in the "exp" claim. Implementers MAY provide for some small leeway, usually no more than a few minutes, to account for clock skew. Its value MUST be a number containing an IntDate value. Use of this claim is OPTIONAL.
In other words, when exp is set, it must be an int value containing a number of seconds since EPOCH.
I want to get the entity creation and update dates. Following the answer to this question, I should get them with
GET /v2/entities/myEntity?options=dateCreated,dateModified
In another source, the v2 reference, under the Virtual Attributes section, the options are slighter different: dateCreation and dateModification.
However, no matter which option I use, I always get the error answer:
{
"error": "BadRequest",
"description": "Invalid value for URI param /options/"
}
How can I get them?
Note: I'm using version 0.26 due to Proton/xml compatibility.
The dateCreated and dateModified options were introduced in Orion 0.28.0:
Add: dateCreated and dateModified options to get entity creation and modification times as "virtual" attributes (Issue #876)
Thus, you should upgrade Orion to that version. Note that Orion 0.28.0 stills supporting XML (in fact, it will be the last release supporting it).
In Fiware CEP's User Manual (pdf), page 12, it's mentioned you can create an event Producer of the type 'Timed', that will retrieve events from a file at intervals of time based on their 'OccurranceTime' property.
In my Fi-Lab's intance I don't find this 'Timed' type of producer in the dropdown list, only: File, JMS, Rest and Custom.
So I thought this feature could be implemented in the type 'File', but I can't get it to work, the property 'sendingDelay' in the Producer, always dictates the reading speed, not 'OccurrenceTime' in the event payload. Deleting 'sendingDelay' from the Producer makes it not send events at all.
OccurranceTime is said, in the manual, to be in milliseconds and in the authoring tool it has variable type of 'Date', so "OccurranceTime":"1000" should mean one second.
So, how can I get events produced at desired times? Is it just a matter of correct formating?
(BTW: in the manual OccurranceTime is spelled in two diferent ways: 'OccuranceTime' and 'OccurranceTime'. I believe the correct one is with double 'r', as it's what the authoring tools gives by default when creating a new event.)
Thank you,
Arthur
Event producer of type 'Timed' is a new feature that is part of release 4 of the CEP. It should be available in FIWARE Lab on October.
When available, you could choose it as the producer's type in the CEP Authoring tool. Then, the CEP will read events from an input file. In this file, you will write the expected occurrence time of each event.
For example, if the content of the input event file in JSON format is:
{"Name":"TrafficReport", "volume":"1000", "OccurrenceTime":"1000"}
{"Name":"TrafficReport", "volume":"1600", "OccurrenceTime":"6000"}
{"Name":"TrafficReport", "volume":"2500", "OccurrenceTime":"11000"}
The producer will process the second input event 5 seconds after the first input event, since it said to occur 5000 ms after the first one.
I'm having some problems trying to do an ItemSearch on the Blended index using the Amazon Product API.
According to the documentation, Blended requests cannot specify the MerchantId parameter - and indeed, if I try to include it I get an error telling me so. However, when I don't include it, I get an error telling me that my request is missing a required parameter combination and that a valid combination includes MerchantId... what the hell?
The failing requests are being sent as part of batches with other requests that are succeeding. I'm using REST to send my requests, so here's an example:
http://ecs.amazonaws.com/onca/xml?AWSAccessKeyId=-------------&
ItemSearch.1.Keywords=Mates%20of%20State&
ItemSearch.1.MerchantId=Amazon&
ItemSearch.1.SearchIndex=DVD&
ItemSearch.2.Keywords=teaching%20Lily%20various%20computer%20related%20skills&
ItemSearch.2.SearchIndex=Blended&
ItemSearch.Shared.Availability=Available&
ItemSearch.Shared.Condition=All&
ItemSearch.Shared.ResponseGroup=Small%2CSalesRank%2CImages%2COfferSummary%2CSimilarities&
Operation=ItemSearch%2CSimilarityLookup&
Service=AWSECommerceService&
SimilarityLookup.1.ItemId=B000FNNHZ2&
SimilarityLookup.2.ItemId=B000EQ5UPU&
SimilarityLookup.Shared.Availability=Available&
SimilarityLookup.Shared.Condition=All&
SimilarityLookup.Shared.MerchantId=Amazon&
SimilarityLookup.Shared.ResponseGroup=Small%2CSalesRank%2CImages%2COfferSummary&
Timestamp=2010-04-02T17%3A18%3A05Z&
Signature=----------------
Here's the XML response:
<Items xmlns="http://webservices.amazon.com/AWSECommerceService/2005-10-05">
<Request>
<IsValid>False</IsValid>
<ItemSearchRequest>
<Availability>Available</Availability>
<Condition>All</Condition>
<Keywords>teaching Lily various computer related skills</Keywords>
<ResponseGroup>Similarities</ResponseGroup>
<ResponseGroup>SalesRank</ResponseGroup>
<ResponseGroup>OfferSummary</ResponseGroup>
<ResponseGroup>Small</ResponseGroup>
<ResponseGroup>Images</ResponseGroup>
<SearchIndex>Blended</SearchIndex>
</ItemSearchRequest>
<Errors>
<Error>
<Code>AWS.MissingParameterCombination</Code>
<Message>Your request is missing a required parameter combination. Required parameter combinations include MerchantId, Availability.</Message>
</Error>
</Errors>
</Request>
</Items>
Any ideas as to what I'm doing wrong?
I seem to have solved this by removing both the Availability and Condition parameters. I'd ideally prefer to be able to filter by availability, but at least it's working.