Question

shekar.chandra on Mon, 22 Jan 2018 13:05:38


Hi,

I have XML data with Parent and Childs information/details which is sent throgh event hub. Stream Analytics is configured to use the XML data and insert into Database tables.
As per the below xml, first I need to insert the transaction data and then insert the respective items and paylines using the inserted transaction(identity column). How do I do that with stream analytics.

Note: There are lot of transactions like this, but for reference I have attached the below xml.  There are primary and foreign key references in the destination tables.

Below is the sample XML:

<Transaction>
    <Id>161</Id>
    <Type>sale</Type>
    <StartDate>2018-01-07T11:28:15+05:30</StartDate>
    <EndDate>2018-01-07T11:28:21+05:30</EndDate>
    <Items>
      <Item>
        <Classification>FUEL DEPOSIT</Classification>
        <UnitPrice>0.00</UnitPrice>
        <Description>CA #03</Description>
        <TaxRate>0</TaxRate>
      </Item>
      <Item>
        <Classification>FUEL DEPOSIT</Classification>
        <UnitPrice>2.00</UnitPrice>
        <Description>SC #01</Description>
        <TaxRate>2</TaxRate>
      </Item>
    </Items>
    <PayLines>
      <PayLine>
        <Cashpayment />
        <Totalamount>0</Totalamount>
        <Totalchange>0</Totalchange>
      </PayLine>
    </PayLines>
</Transaction>

Thanks,
Chandra


Chandra Shekar Y


Replies

Min He - MSFT on Mon, 29 Jan 2018 23:48:00


Azure Stream Analytics does not support XML message payload. The supported formats are: JSON, CSV, and Avro. 

You may want to use Azure Function to convert the message to JSON format and write JSON messages back to Event Hub, then Stream Analytics job can consume these converted messages.