Is it possible to connect to Kafka/KSQL backend or similar streaming applications? if so any examples would be much appreciated …
Hi, I’m not experienced yet with Kafka, although is one of the next things that I intend to explore. However, I believe you could try a Python client for the Apache Kafka distributed stream processing system. (https://pypi.org/project/kafka-python/)
pip install kafka-python
And then use Anvil Uplink (https://anvil.works/docs/uplink/setting_up)
Would love to hear how you solve it or if someone else has a better solution.
Thanks Luis so this anvil uplink is the interface to the outside world?
Hi @minscheung,
If you’re accessing a resource outside Anvil (be it a database, a Kafka instance, or something else), there are two ways to do it.
-
Access the resource directly from your Server Modules, using the standard Python libraries. (If you need a library
pip install
ing, drop a line to support@anvil.works). This is the easiest way to do it: Your code will make a direct connection from the Anvil server it’s running on to your Kafka instance.Here is an example of connecting to an external database from a Server Module.
-
If the resource you need is behind a firewall, and can’t be accessed directly from Anvil, then you can use the Uplink. In this case, you run a Python script on your own computer (behind the firewall), and use the Uplink to give your Anvil app access to certain Python functions that access that resource.
Here is a tutorial showing you how to build an app that accesses a local (ie firewalled) database via the Uplink.
So Anvil is similar to Angular/React /Flutter but all in Python?
Anvil is fullstack like MEAN. The above-mentioned ones are only front end
Apart from using python, the main diference is that it is 7x faster or even more to develop web apps. Over last 20 years, I only find joy when using anvil recently
pip install kafka-python
so this is the first pip needed?
Need to pay to:
pip install kafka-python when it is open sourced?
If you want anything pip installed on anvil servers you have to be on the paid plan to use it.
Anvil free plans are a sandboxed environment for running python. Here’s a link to a short talk about the free plan and how it’s hosted.