-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed bug where Kafka-Topic would use the wrong type of config
- Loading branch information
1 parent
4953569
commit a64bb05
Showing
6 changed files
with
116 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package body Kafka.Topic.Config is | ||
Error_Buffer_Size : constant size_t := 512; | ||
RD_Kafka_Conf_OK : constant Integer := 0; | ||
|
||
procedure Set(Config : Topic_Config_Type; | ||
Name : String; | ||
Value : String) is | ||
C_Name : chars_ptr := New_String(Name); | ||
C_Value : chars_ptr := New_String(Value); | ||
C_Err : chars_ptr := Alloc(Error_Buffer_Size); | ||
Result : Integer; | ||
begin | ||
Result := rd_kafka_topic_conf_set(Config, C_Name, C_Value, C_Err, Error_Buffer_Size); | ||
|
||
if Result /= RD_Kafka_Conf_OK then | ||
declare | ||
Error : String := Interfaces.C.Strings.Value(C_Err); | ||
begin | ||
Free(C_Name); | ||
Free(C_Value); | ||
Free(C_Err); | ||
raise Kafka_Error with Error; | ||
end; | ||
end if; | ||
|
||
Free(C_Name); | ||
Free(C_Value); | ||
Free(C_Err); | ||
end Set; | ||
end Kafka.Topic.Config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
|
||
|
||
package Kafka.Topic.Config is | ||
|
||
-- | ||
-- Creates a new kafka topic config object | ||
-- | ||
-- librdkafka equivalent: rd_kafka_topic_conf_new | ||
-- | ||
function Create return Topic_Config_Type | ||
with Import => True, | ||
Convention => C, | ||
External_Name => "rd_kafka_topic_conf_new"; | ||
|
||
-- | ||
-- Destroys a kafka topic config object | ||
-- | ||
-- librdkafka equivalent: rd_kafka_topic_conf_destroy | ||
-- | ||
-- @param Config configuration to destroy | ||
-- | ||
procedure Destroy(Config : Topic_Config_Type) | ||
with Import => True, | ||
Convention => C, | ||
External_Name => "rd_kafka_topic_conf_destroy"; | ||
|
||
-- | ||
-- Duplicates a kafka topic config object | ||
-- | ||
-- librdkafka equivalent: rd_kafka_topic_conf_dup | ||
-- | ||
-- @param Config configuration to duplicate | ||
-- | ||
function Duplicate(Config : Topic_Config_Type) return Topic_Config_Type | ||
with Import => True, | ||
Convention => C, | ||
External_Name => "rd_kafka_topic_conf_dup"; | ||
|
||
-- | ||
-- Sets a kafka topic config property for a given kafka topic config. | ||
-- | ||
-- librdkafka equivalent: rd_kafka_topic_conf_set | ||
-- | ||
-- @param Config configuration to set the property in | ||
-- @param Name name of property to set | ||
-- @param Value value of property to set | ||
-- @raises Kafka_Error on error | ||
-- | ||
procedure Set(Config : Topic_Config_Type; | ||
Name : String; | ||
Value : String); | ||
private | ||
|
||
function rd_kafka_topic_conf_set(conf : Topic_Config_Type; | ||
name : chars_ptr; | ||
value : chars_ptr; | ||
errstr : chars_ptr; | ||
errstr_size : size_t) return Integer | ||
with Import => True, | ||
Convention => C, | ||
External_Name => "rd_kafka_topic_conf_set"; | ||
|
||
end Kafka.Topic.Config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters