Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
169 commits
Select commit Hold shift + click to select a range
c7f4627
POC
attilakreiner Jan 22, 2024
1a7592f
fix
attilakreiner Jan 23, 2024
3609baa
WIP HttpEventContext
attilakreiner Jan 23, 2024
d4a6ec6
WIP core Event
attilakreiner Jan 23, 2024
ddef06c
WIP EngineWorker logEvent
attilakreiner Jan 23, 2024
a4399ca
WIP code BindingEvent
attilakreiner Jan 23, 2024
66202a9
WIP h2
attilakreiner Jan 23, 2024
d67cf9e
WIP identity
attilakreiner Jan 24, 2024
95aefb3
WIP mqtt
attilakreiner Jan 24, 2024
e137363
fix
attilakreiner Jan 24, 2024
7cd659f
fix
attilakreiner Jan 24, 2024
3c40746
WIP MessageConsumer
attilakreiner Jan 24, 2024
e58cd98
WIP SchemaRegistryEventContext
attilakreiner Jan 25, 2024
e6a4c09
WIP TcpEventContext
attilakreiner Jan 25, 2024
2916bed
WIP tls
attilakreiner Jan 26, 2024
35a723c
WIP kafka
attilakreiner Jan 26, 2024
d304db7
WIP kafka apiversion
attilakreiner Jan 26, 2024
5d3d78b
mv schmea_registry.idl
attilakreiner Jan 29, 2024
4b86a93
WIP fix rm Result
attilakreiner Jan 29, 2024
d18a716
ref lvl
attilakreiner Jan 29, 2024
66ea78f
Add catalogId
attilakreiner Jan 29, 2024
10663a8
fix rm initialId
attilakreiner Jan 29, 2024
adba065
fix 1
attilakreiner Jan 30, 2024
5504201
fix 2
attilakreiner Jan 30, 2024
bd145f6
fix 3
attilakreiner Jan 30, 2024
2162630
fix 4
attilakreiner Jan 30, 2024
1b9d779
fix 5
attilakreiner Jan 30, 2024
f2e867b
fix 6
attilakreiner Jan 30, 2024
6af5130
fix 7
attilakreiner Jan 30, 2024
4efa893
WIP kafka api version
attilakreiner Jan 31, 2024
a8e6e8c
Merge branch 'develop' into log
attilakreiner Feb 5, 2024
3be3ed3
fix
attilakreiner Feb 5, 2024
377ca3c
ref proxy.idl to tls.idl
attilakreiner Feb 5, 2024
45d33e4
ref proxy.idl to tcp.idl
attilakreiner Feb 5, 2024
ded8235
fix
attilakreiner Feb 5, 2024
431300d
fix
attilakreiner Feb 5, 2024
33d1745
WIP EventsLayout
attilakreiner Feb 5, 2024
f8e4ced
WIP timestamp
attilakreiner Feb 5, 2024
a8d6b19
WIP StdoutExporter
attilakreiner Feb 6, 2024
a675aac
WIP EventsLayout
attilakreiner Feb 7, 2024
da36031
WIP spy
attilakreiner Feb 7, 2024
907aacc
WIP PrintableEventsStream
attilakreiner Feb 8, 2024
b972881
fix
attilakreiner Feb 8, 2024
5083758
fix
attilakreiner Feb 8, 2024
168cad4
fix
attilakreiner Feb 8, 2024
54447ad
fix capacity
attilakreiner Feb 8, 2024
a04f78f
WIP EventsLayoutReader rotate
attilakreiner Feb 8, 2024
056a1a8
fix StdoutEventsStream
attilakreiner Feb 9, 2024
9ff65ea
fix schema
attilakreiner Feb 9, 2024
c3b8844
fix typeId
attilakreiner Feb 9, 2024
ada8412
fix logger
attilakreiner Feb 9, 2024
c0f74bb
fix authorization
attilakreiner Feb 9, 2024
62ed116
fix namespacedId
attilakreiner Feb 9, 2024
cd263c6
fix supply*
attilakreiner Feb 9, 2024
f8c0174
fix logger
attilakreiner Feb 9, 2024
e33e09b
fix
attilakreiner Feb 9, 2024
7a8e33e
fix
attilakreiner Feb 9, 2024
c712d7b
fix lookupLabelId
attilakreiner Feb 9, 2024
2c0ea9f
fix
attilakreiner Feb 9, 2024
be4fa06
WIP ref
attilakreiner Feb 9, 2024
786d434
WIP spies
attilakreiner Feb 9, 2024
d0f8585
WIP spies
attilakreiner Feb 9, 2024
c5a482c
WIP spies
attilakreiner Feb 12, 2024
1c31152
WIP spies
attilakreiner Feb 12, 2024
b934025
WIP StdoutEventsStream
attilakreiner Feb 12, 2024
5fe3ab4
Merge branch 'develop' into log
attilakreiner Feb 12, 2024
be6486b
add EventsLayoutTest
attilakreiner Feb 12, 2024
8824343
fix pom
attilakreiner Feb 12, 2024
bfa4aca
add StdoutExporterHandlerTest
attilakreiner Feb 12, 2024
62f976e
fix
attilakreiner Feb 12, 2024
624e7ef
fix
attilakreiner Feb 13, 2024
3f9b66c
fix
attilakreiner Feb 13, 2024
8f39a77
fix onDecodeResponseErrorCode
attilakreiner Feb 13, 2024
0f57f30
rm accessDeinied
attilakreiner Feb 13, 2024
393b00b
fix internal
attilakreiner Feb 13, 2024
705ad99
cleanup
attilakreiner Feb 13, 2024
8d63a5d
fix EventReader
attilakreiner Feb 13, 2024
b7dfcd9
cleanup
attilakreiner Feb 13, 2024
7ef306d
fix EventHandler
attilakreiner Feb 13, 2024
4a5a7f6
fix
attilakreiner Feb 13, 2024
633ed14
fix tcp
attilakreiner Feb 13, 2024
1289396
fix
attilakreiner Feb 13, 2024
c47719f
fix
attilakreiner Feb 14, 2024
ed04985
WIP RingBufferSpy
attilakreiner Feb 15, 2024
db2cf89
Revert "WIP RingBufferSpy"
attilakreiner Feb 16, 2024
6b74346
WIP eventReadingQueue
attilakreiner Feb 15, 2024
29d06f3
WIP sortEventIndicesByTimestamps
attilakreiner Feb 16, 2024
5740ead
test stdout
attilakreiner Feb 16, 2024
0acc7f4
fix Engine readEvent
attilakreiner Feb 19, 2024
baf1c19
WIP http server log
attilakreiner Feb 19, 2024
39e737d
rm level
attilakreiner Feb 20, 2024
da6cb7b
fix onDecodeResponseErrorCode
attilakreiner Feb 20, 2024
05db0f4
fix tcp remoteAddress
attilakreiner Feb 20, 2024
cf554b6
fix tcp traceId doNetConnect
attilakreiner Feb 20, 2024
776c2ec
fix tcp traceId 0 onNetConnect
attilakreiner Feb 20, 2024
10cfdfc
fix mv MessageReader
attilakreiner Feb 20, 2024
f302779
fix Engine supplyEventReader
attilakreiner Feb 20, 2024
035589e
fix mv lookupTypeId
attilakreiner Feb 20, 2024
ceb2efc
fix mv remoteaddressrejected
attilakreiner Feb 20, 2024
d2665ac
fix mv supplyEventWriter
attilakreiner Feb 20, 2024
7415d67
fix mv tcp.idl
attilakreiner Feb 20, 2024
68e1b0c
fix mv http.idl
attilakreiner Feb 20, 2024
e888bcf
fix mv kafka.idl
attilakreiner Feb 20, 2024
730ecaf
fix mv mqtt.idl
attilakreiner Feb 20, 2024
4c4b0e6
fix mv schema_registry.idl
attilakreiner Feb 20, 2024
f359b76
fix mv tls.idl
attilakreiner Feb 20, 2024
154f0ef
fix Clock
attilakreiner Feb 20, 2024
31f69a8
fix EventReader inner class
attilakreiner Feb 20, 2024
853f794
fix timestamp
attilakreiner Feb 20, 2024
4f9009d
fix kafka
attilakreiner Feb 21, 2024
68d6ffd
fix tcp
attilakreiner Feb 21, 2024
856d40d
fix engine
attilakreiner Feb 21, 2024
e2a4edf
fix stdout exp
attilakreiner Feb 21, 2024
6559700
fix tcp
attilakreiner Feb 21, 2024
7261233
fix supplyTypeId
attilakreiner Feb 21, 2024
fa8db9b
fix tls
attilakreiner Feb 21, 2024
df71e7f
fix rm http response
attilakreiner Feb 21, 2024
d766096
fix http auth failure
attilakreiner Feb 21, 2024
de6cdaf
fix kafka auth failure
attilakreiner Feb 21, 2024
c57b3d2
fix mqtt auth failure
attilakreiner Feb 21, 2024
d681727
fix http log format
attilakreiner Feb 21, 2024
cbb6316
fix kafka log format
attilakreiner Feb 21, 2024
11790f1
fix mqtt log format
attilakreiner Feb 21, 2024
c802e2c
fix tcp log format
attilakreiner Feb 21, 2024
41a8d3b
fix tls log format
attilakreiner Feb 21, 2024
cc4987c
fix schreg log format
attilakreiner Feb 21, 2024
71a6818
fix revert schreg
attilakreiner Feb 22, 2024
02f3b7b
fix identity
attilakreiner Feb 22, 2024
0532c2c
fix rm traceId
attilakreiner Feb 22, 2024
4736c14
fix rm event type name
attilakreiner Feb 22, 2024
af555ce
fix http
attilakreiner Feb 22, 2024
787424b
fix kafka
attilakreiner Feb 22, 2024
74ee442
fix mqtt
attilakreiner Feb 22, 2024
43c7b7c
fix date time format
attilakreiner Feb 22, 2024
64ccd2c
fix const
attilakreiner Feb 22, 2024
37dc1fb
fix supplyQName
attilakreiner Feb 22, 2024
96f0866
fix Stdout*Handler
attilakreiner Feb 22, 2024
12afe60
fix context
attilakreiner Feb 22, 2024
94c2e69
fix http add fields
attilakreiner Feb 22, 2024
858be23
fix http event names
attilakreiner Feb 22, 2024
9f2d72a
fix add http authority
attilakreiner Feb 22, 2024
e807d04
fix
attilakreiner Feb 22, 2024
bd9c1a4
impl first k3po test in stdexp
attilakreiner Feb 26, 2024
434cbee
fix stdexp formats
attilakreiner Feb 26, 2024
a0b1ddb
fix engine test
attilakreiner Feb 26, 2024
bcd2944
fix kafka
attilakreiner Feb 26, 2024
9c54422
fix tls
attilakreiner Feb 26, 2024
115405d
fix bindingId in *EventContext
attilakreiner Feb 26, 2024
e1d6a98
fix idl
attilakreiner Feb 26, 2024
4f3ecc0
WIP jwt authFail
attilakreiner Feb 26, 2024
e01ae34
WIP jwt traceId, bindingId
attilakreiner Feb 26, 2024
15937c6
WIP rm mqtt
attilakreiner Feb 26, 2024
259e5fb
WIP fix Http11EventsIT
attilakreiner Feb 26, 2024
3ca772b
WIP fix rm http authFail
attilakreiner Feb 26, 2024
bb83580
fix kafka authFail
attilakreiner Feb 26, 2024
864a587
add http2 test
attilakreiner Feb 26, 2024
39ea9a7
add kafka test
attilakreiner Feb 26, 2024
18d823f
add tls test
attilakreiner Feb 26, 2024
814f74e
add tcp test
attilakreiner Feb 27, 2024
3922e15
add jwt test
attilakreiner Feb 27, 2024
15711a1
add sch-reg test
attilakreiner Feb 27, 2024
1cc1e1b
fix
attilakreiner Feb 27, 2024
9c4f1f3
fix tcp 1
attilakreiner Feb 27, 2024
7f9d7a6
fix tcp 2
attilakreiner Feb 27, 2024
e30ec02
fix tcp 3
attilakreiner Feb 27, 2024
0a0d97d
rm sch-reg test
attilakreiner Feb 28, 2024
9748627
ref jwt test
attilakreiner Feb 28, 2024
b149557
fix
attilakreiner Feb 28, 2024
3076f6f
revert model-json chg
attilakreiner Feb 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
WIP mqtt
  • Loading branch information
attilakreiner committed Jan 25, 2024
commit 95aefb3150fca7a6c831b7e8fb59349247b54fef
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
* Copyright 2021-2023 Aklivity Inc.
*
* Aklivity licenses this file to you under the Apache License,
* version 2.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.aklivity.zilla.runtime.binding.mqtt.internal;

import java.nio.ByteBuffer;
import java.util.function.Consumer;

import org.agrona.MutableDirectBuffer;
import org.agrona.concurrent.UnsafeBuffer;

import io.aklivity.zilla.runtime.binding.mqtt.internal.types.event.Level;
import io.aklivity.zilla.runtime.binding.mqtt.internal.types.event.MqttEventFW;
import io.aklivity.zilla.runtime.binding.mqtt.internal.types.event.Result;
import io.aklivity.zilla.runtime.engine.EngineContext;

public class MqttEventContext
{
private static final int EVENT_BUFFER_CAPACITY = 1024;

private final MqttEventFW.Builder mqttEventRW = new MqttEventFW.Builder();
private final MutableDirectBuffer eventBuffer = new UnsafeBuffer(ByteBuffer.allocate(EVENT_BUFFER_CAPACITY));
private final Consumer<MqttEventFW> logEvent;

public MqttEventContext(
EngineContext context)
{
this.logEvent = context::logEvent;
}

public void authorization(
Result result,
Level level,
long originId,
long routedId,
long initialId,
long replyId,
long traceId,
String identity)
{
MqttEventFW event = mqttEventRW
.wrap(eventBuffer, 0, eventBuffer.capacity())
.authorization(e -> e
.result(r -> r.set(result))
.level(l -> l.set(level))
.originId(originId)
.routedId(routedId)
.initialId(initialId)
.replyId(replyId)
.traceId(traceId)
.identity(identity)
)
.build();
logEvent.accept(event);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
import io.aklivity.zilla.runtime.binding.mqtt.config.MqttPatternConfig.MqttConnectProperty;
import io.aklivity.zilla.runtime.binding.mqtt.internal.MqttBinding;
import io.aklivity.zilla.runtime.binding.mqtt.internal.MqttConfiguration;
import io.aklivity.zilla.runtime.binding.mqtt.internal.MqttEventContext;
import io.aklivity.zilla.runtime.binding.mqtt.internal.MqttValidator;
import io.aklivity.zilla.runtime.binding.mqtt.internal.config.MqttBindingConfig;
import io.aklivity.zilla.runtime.binding.mqtt.internal.config.MqttRouteConfig;
Expand Down Expand Up @@ -167,6 +168,8 @@
import io.aklivity.zilla.runtime.binding.mqtt.internal.types.codec.MqttUserPropertyFW;
import io.aklivity.zilla.runtime.binding.mqtt.internal.types.codec.MqttWillV4FW;
import io.aklivity.zilla.runtime.binding.mqtt.internal.types.codec.MqttWillV5FW;
import io.aklivity.zilla.runtime.binding.mqtt.internal.types.event.Level;
import io.aklivity.zilla.runtime.binding.mqtt.internal.types.event.Result;
import io.aklivity.zilla.runtime.binding.mqtt.internal.types.stream.AbortFW;
import io.aklivity.zilla.runtime.binding.mqtt.internal.types.stream.BeginFW;
import io.aklivity.zilla.runtime.binding.mqtt.internal.types.stream.DataFW;
Expand Down Expand Up @@ -403,6 +406,7 @@ public final class MqttServerFactory implements MqttStreamFactory
private final Map<MqttPacketType, MqttServerDecoder> decodersByPacketTypeV5;
private final IntSupplier supplySubscriptionId;
private final EngineContext context;
private final MqttEventContext event;

private int maximumPacketSize = Integer.MAX_VALUE;

Expand Down Expand Up @@ -527,6 +531,7 @@ public MqttServerFactory(
this.decodePacketTypeByVersion.put(MQTT_PROTOCOL_VERSION_4, this::decodePacketTypeV4);
this.decodePacketTypeByVersion.put(MQTT_PROTOCOL_VERSION_5, this::decodePacketTypeV5);
this.unreleasedPacketIdsByClientId = unreleasedPacketIdsByClientId;
this.event = new MqttEventContext(context);
}

@Override
Expand Down Expand Up @@ -2923,6 +2928,11 @@ else if (this.authField.equals(MqttConnectProperty.PASSWORD))
if (credentialsMatch != null)
{
sessionAuth = guard.reauthorize(initialId, credentialsMatch);
event.authorization(
sessionAuth == 0 ? Result.FAILURE : Result.SUCCESS,
Comment thread
attilakreiner marked this conversation as resolved.
Outdated
sessionAuth == 0 ? Level.WARNING : Level.INFO,
originId, routedId, initialId, replyId, traceId,
guard.identity(sessionId));
}
}

Expand Down
18 changes: 18 additions & 0 deletions specs/binding-mqtt.spec/src/main/resources/META-INF/zilla/mqtt.idl
Original file line number Diff line number Diff line change
Expand Up @@ -257,4 +257,22 @@ scope mqtt
int16[length] packetIds;
}
}

scope event
{
enum MqttEventType (uint8)
{
AUTHORIZATION (1)
}

struct MqttAuthorizationEvent extends core::event::BindingEvent
{
string8 identity;
}

union MqttEvent switch (MqttEventType)
{
case AUTHORIZATION: MqttAuthorizationEvent authorization;
}
}
}