SvenO3 commented on code in PR #1286:
URL: https://github.com/apache/streampipes/pull/1286#discussion_r1106815291
##########
streampipes-client-python/streampipes/model/common.py:
##########
@@ -115,37 +131,41 @@ class TopicDefinition(BasicModel):
Data model of a `TopicDefinition` in compliance to the StreamPipes Backend.
"""
- class_name: Optional[StrictStr] = Field(alias="@class")
- actual_topic_name: StrictStr
+ class_name: Optional[StrictStr] = Field(
+ alias="@class", default_factory=lambda:
"org.apache.streampipes.model.grounding.SimpleTopicDefinition"
+ )
+ actual_topic_name: StrictStr = Field(default_factory=lambda:
f"org.apache.streampipes.connect.{uuid4()}")
class TransportProtocol(BasicModel):
"""
Data model of a `TransportProtocol` in compliance to the StreamPipes
Backend.
"""
- class_name: StrictStr = Field(alias="@class")
- element_id: Optional[StrictStr]
- broker_hostname: StrictStr
- topic_definition: TopicDefinition
- port: StrictInt = Field(alias="kafkaPort")
+ class_name: StrictStr = Field(
+ alias="@class", default_factory=lambda:
"org.apache.streampipes.model.grounding.NatsTransportProtocol"
+ )
+ element_id: StrictStr = Field(default_factory=lambda:
f"sp:transportprotocol:{random_letters(6)}")
+ broker_hostname: StrictStr = "nats"
+ topic_definition: TopicDefinition = Field(default_factory=TopicDefinition)
+ port: StrictInt = Field(alias="kafkaPort", default_factory=lambda: 4222)
Review Comment:
I think it's only for Nats, but the idea was to use Nats as default and you
would need to configure this if you want to use other transport protocols.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]