rabbitmq – Not able to import pyspark.streaming.mqtt.MQTTUtils

I am not able to import the below lines..

from pyspark import SparkContext
from pyspark.streaming import StreamingContext
from pyspark.streaming.mqtt import MQTTUtils

It is throwing error as below.

ModuleNotFoundError                       Traceback (most recent call last)
Input In [3], in <module>
      1 from pyspark import SparkContext
      2 from pyspark.streaming import StreamingContext
----> 3 from pyspark.streaming.mqtt import MQTTUtils

ModuleNotFoundError: No module named 'pyspark.streaming.mqtt

I have download the rabbitMQ jar files and saved in jar directory too but still I am not able to import.

Also I would like to make clear that I am completely new for spark. I have task to pull the data from AMQP topics based on spark structure streaming. How can I do it please suggest if you have any idea. It would be helpful if someone take the initiative to explain through sample code. There is very less information on internet for pyspark. please, share your thoughts.

Read more here: Source link