|
3 | 3 | import logging
|
4 | 4 |
|
5 | 5 | import nest_asyncio
|
| 6 | +from apicurioregistrysdk.client.search.artifacts.artifacts_request_builder import ArtifactsRequestBuilder |
| 7 | + |
6 | 8 | nest_asyncio.apply()
|
7 | 9 |
|
8 | 10 | from hashlib import md5
|
@@ -46,8 +48,26 @@ async def _async_init(
|
46 | 48 | self.registry_client = RegistryClient(request_adapter)
|
47 | 49 |
|
48 | 50 | try:
|
49 |
| - self.known_schema_registry_subjects: ArtifactSearchResults = await self.registry_client.search.artifacts.get() |
| 51 | + limit = self.source_config.connection.schema_registry_config.get("pagination") |
| 52 | + if limit == None: |
| 53 | + logger.warning(f"Unable to get pagination key in recipe. Setting maximum number of artifacts to be returned to default 20") |
| 54 | + limit = 20 |
| 55 | + else: |
| 56 | + logger.info(f"Maximum number of artifacts to be returned: {limit}") |
| 57 | + |
| 58 | + query_params = ArtifactsRequestBuilder.ArtifactsRequestBuilderPostQueryParameters( |
| 59 | + limit=limit |
| 60 | + ) |
| 61 | + |
| 62 | + request_configuration = ( |
| 63 | + ArtifactsRequestBuilder.ArtifactsRequestBuilderPostRequestConfiguration( |
| 64 | + query_parameters=query_params |
| 65 | + ) |
| 66 | + ) |
| 67 | + self.known_schema_registry_subjects: ArtifactSearchResults = await self.registry_client.search.artifacts.get(request_configuration=request_configuration) |
50 | 68 | logger.info(f"Known schema registry subjects: {self.known_schema_registry_subjects.count}")
|
| 69 | + for artifact in self.known_schema_registry_subjects.artifacts: |
| 70 | + logger.info(f"known artifact id: {artifact.id}") |
51 | 71 | except Exception as e:
|
52 | 72 | logger.warning(f"Failed to get artifacts from schema registry: {e}")
|
53 | 73 |
|
@@ -109,15 +129,15 @@ async def _get_schema_and_fields(
|
109 | 129 | # Obtain the schema fields from schema for the topic.
|
110 | 130 | fields: List[SchemaField] = []
|
111 | 131 | if artifact is not None:
|
112 |
| - logger.debug( |
| 132 | + logger.info( |
113 | 133 | f"The {schema_type_str} schema subject:'{artifact.id}', grp ID:'{artifact.group_id}' is found for topic:'{topic}'."
|
114 | 134 | )
|
115 | 135 | fields = await self._get_schema_fields(
|
116 | 136 | topic=topic, artifact=artifact, is_key_schema=is_key_schema
|
117 | 137 | )
|
118 | 138 | else:
|
119 |
| - logger.debug( |
120 |
| - f"For topic: {topic}, the schema registry subject for the schema is not found." |
| 139 | + logger.info( |
| 140 | + f"For topic: {topic}, the {schema_type_str} schema registry subject for the schema is not found." |
121 | 141 | )
|
122 | 142 | return artifact, fields
|
123 | 143 |
|
|
0 commit comments