Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

326
Visualizações
Amazon EventBridge: Match an object inside of an array

I've stuck the problem with defining a rule for matching my events. Googled, tested.

Let's say, we've the following event which contains the object user in the array events:

{
    "version": "0",
    "...": "...",
    "detail": {
        "events": [
            {
                "user": {
                    "id": "5efdee60b48e7c1836078290"
                }
            }
        ]
    }
}

Is there any way to match the user.id in an EventBus rule? I've already tried to use the following rule which is not valid:

{
  "detail": {
    "events": [
      {
        "user": {
          "id": [
            "5efdee60b48e7c1836078290"
          ]
        }
      }
    ]
  }
}

then,

{
  "detail": {
    "events[0]": {
      "user": {
        "id": [
          "5efdee60b48e7c1836078290"
        ]
      }
    }
  }
}

also no effect.

I don't want to give up, but I'm tired with it ;)

over 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

This pattern should work to match this event:

{
  "detail": {
    "events": {
      "user": {
        "id": [
          "5efdee60b48e7c1836078290"
        ]
      }
    }
  }
}
over 4 years ago · Santiago Trujillo Relatório

0

Today, EventBridge only supports matching simple values (string, integer, boolean, null) with an array. You can read more in the service documentation.

over 4 years ago · Santiago Trujillo Relatório

0

I did some playing around with your example but I can't make it work. Based on reading the Arrays in EventBridge Event Patterns I have to conclude that matching inside arrays with complex values is not possible.

The quote that seems to confirm this is "If the value in the event is an array, then the pattern matches if the intersection of the pattern array and the event array is non-empty."

And from the Event Patterns page "Match values are always in arrays." So if your pattern is an array and the value in the event is also an array (this is the example you gave), a "set" based intersection test is performed. Your pattern would have to match the entire array entry, not just a single field like you have in the example.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda