Skip to content

Commit e7e78ec

Browse files
committed
221 - cleanup
1 parent 9bebad0 commit e7e78ec

File tree

5 files changed

+9
-16
lines changed

5 files changed

+9
-16
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1212
- Support publishing events consumed from [NATS](https://nats.io) topics. See the [documentation](https://accenture.github.io/reactive-interaction-gateway/docs/event-streams.html#nats) for how to get started. [#297](https://github.com/Accenture/reactive-interaction-gateway/issues/297)
1313
- Added validation for reverse proxy configuration. Now it crashes RIG on start when configuration is not valid or returns `400` when using REST API to update configuration. [#277](https://github.com/Accenture/reactive-interaction-gateway/issues/277)
1414
- Added basic distributed tracing support in [W3C Trace Context specification](https://www.w3.org/TR/trace-context/) with Jaeger and Openzipkin exporters. RIG opens a span at the API Gateway and emits trace context in Cloud Events following the [distributed tracing spec](https://github.com/cloudevents/spec/blob/v1.0/extensions/distributed-tracing.md). [#281](https://github.com/Accenture/reactive-interaction-gateway/issues/281)
15-
- Added possibility to set response code for `response_from` messages in reverse proxy. [#321](https://github.com/Accenture/reactive-interaction-gateway/pull/321)
15+
- Added possibility to set response code for `response_from` messages in reverse proxy (`kafka` and `http_async`). [#321](https://github.com/Accenture/reactive-interaction-gateway/pull/321)
1616

1717
### Changed
1818

1919
- Incorporated [cloudevents-ex](https://github.com/kevinbader/cloudevents-ex) to handle binary and structured modes for [Kafka protocol binding](https://github.com/cloudevents/spec/blob/v1.0/kafka-protocol-binding.md) in a proper way. This introduces some **breaking changes**:
2020
- Binary mode is now using `ce_` prefix for CloudEvents context attribute headers, before it was `ce-` - done according to the [Kafka protocol binding](https://github.com/cloudevents/spec/blob/v1.0/kafka-protocol-binding.md)
2121
- Change above affects also `"response_from": "kafka"` proxy functionality. RIG will forward to clients only Kafka body, no headers. This means, when using binary mode, clients receive only the data part, no CloudEvents context attributes.
22-
- Changed `response_from` handler to expect a message in binary format, **NOT** a cloud event. [#321](https://github.com/Accenture/reactive-interaction-gateway/pull/321)
22+
- Changed `response_from` handler to expect a message in binary format, **NOT** a cloud event (`kafka` and `http_async`). [#321](https://github.com/Accenture/reactive-interaction-gateway/pull/321)
2323

2424
### Fixed
2525

config/rig_inbound_gateway/config.exs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,6 @@ config :rig, RigInboundGatewayWeb.V1.SubscriptionController, cors: cors
172172
config :rig, RigInboundGatewayWeb.V1.SSE, cors: cors
173173
config :rig, RigInboundGatewayWeb.V1.LongpollingController, cors: cors
174174

175-
config :rig, RigInboundGateway.ApiProxy.ResponseFromParser,
176-
schema_registry_host: {:system, "KAFKA_SCHEMA_REGISTRY_HOST", nil}
177-
178175
# Import environment specific config. This must remain at the bottom
179176
# of this file so it overrides the configuration defined above.
180177
import_config "#{Mix.env()}.exs"

docs/api-gateway.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,6 @@ Configuration of such API endpoint might look like this:
214214
215215
`http_async` means that correlated response has to be sent to internal `:4010/v2/responses` `POST` endpoint.
216216
217-
`response_from="kafka"` will try to decode Avro encoded message.
218-
219217
#### Supported formats
220218
221219
All `response_from` options support only binary mode.

lib/rig_inbound_gateway/api_proxy/handler/kafka.ex

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@ defmodule RigInboundGateway.ApiProxy.Handler.Kafka do
4343
| {:error, %{:__exception__ => true, :__struct__ => atom(), optional(atom()) => any()},
4444
any()}
4545
def kafka_handler(message, headers) do
46-
with {deserialized_pid, response_code, response} <-
47-
ResponseFromParser.parse(headers, message) do
48-
Logger.debug(fn ->
49-
"HTTP response via Kafka to #{inspect(deserialized_pid)}: #{inspect(message)}"
50-
end)
46+
case ResponseFromParser.parse(headers, message) do
47+
{deserialized_pid, response_code, response} ->
48+
Logger.debug(fn ->
49+
"HTTP response via Kafka to #{inspect(deserialized_pid)}: #{inspect(message)}"
50+
end)
51+
52+
send(deserialized_pid, {:response_received, response, response_code})
5153

52-
send(deserialized_pid, {:response_received, response, response_code})
53-
else
5454
err ->
5555
Logger.warn(fn -> "Parse error #{inspect(err)} for #{inspect(message)}" end)
5656
:ignore

lib/rig_inbound_gateway/api_proxy/response_from_parser.ex

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ defmodule RigInboundGateway.ApiProxy.ResponseFromParser do
66

77
require Logger
88

9-
use Rig.Config, [:schema_registry_host]
10-
119
alias Rig.Connection.Codec
1210

1311
# ---

0 commit comments

Comments
 (0)