通过logicapps将自定义消息发布到事件网格

时间:2018-09-08 07:29:17

标签: azure-eventgrid

我正在使用logicapp中的发布事件

{
  "error": {
    "code": "BadRequest",
    "message": "Unexpected token when reading JSON. Expected: StartObject, actual: StartArray. Report '01a24d3c-7588-4580-b650-52aa4f25b805:9/8/2018 7:17:33 AM (UTC)' to our forums for assistance or raise a support ticket.",
    "details": [
      {
        "code": "InputJsonInvalid",
        "message": "Unexpected token when reading JSON. Expected: StartObject, actual: StartArray. Report '01a24d3c-7588-4580-b650-52aa4f25b805:9/8/2018 7:17:33 AM (UTC)' to our forums for assistance or raise a support ticket."
      }
    ]
  }
}

所以我尝试发送示例消息

[
  {
    "id": "1807",
    "eventType": "recordInserted",
    "subject": "myapp/vehicles/motorcycles",
    "eventTime": "2017-08-10T21:03:07+00:00",
    "data": {
      "make": "Ducati",
      "model": "Monster"
    },
    "dataVersion": "1.0"
  }
]

但仍然得到相同的结果。

1 个答案:

答案 0 :(得分:0)

对于 CloudEvent 模式,请尝试以下示例消息:

package navi;

import java.awt.AWTException;
import java.awt.Robot;
import java.awt.event.KeyEvent;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;

public class Monika {
    private static WebDriver driver;

    WebDriverWait wait5s = new WebDriverWait(driver,5);

    @BeforeClass
    public static void setUpClass() {
        System.setProperty("webdriver.chrome.driver", "C:\\Users\\pburgr\\Desktop\\chromedriver\\chromedriver.exe");
        ChromeOptions options = new ChromeOptions();
        options.addArguments("user-data-dir=C:\\Users\\pburgr\\AppData\\Local\\Google\\Chrome\\User Data");
        driver = new ChromeDriver(options);
        driver.manage().window().maximize();}   
    @Before
    public void setUp() {}
    @After
    public void tearDown() {}
    @AfterClass
    public static void tearDownClass() {driver.close();driver.quit();}
    @Test
    public void autofill_first_value () throws InterruptedException, AWTException {

        driver.get("https://www.google.com/");
        WebElement fld_search = wait5s.until(ExpectedConditions.elementToBeClickable(By.id("lst-ib")));
        fld_search.click();
        fld_search.sendKeys("french");

        Robot rob = new Robot();                          
        rob.keyPress(KeyEvent.VK_DOWN); 
        rob.keyRelease(KeyEvent.VK_DOWN);
        Thread.sleep(1000);

        String foo1 = driver.findElement(By.xpath("//*[@id=\"sbse0\"]/div[2]/b")).getText();
        fld_search.sendKeys(" " + foo1);

        Thread.sleep(5000);

        // hit the search button...
    }
}