@胡 海云 Thanks for reaching out. I would probably break the linebot stuff outside the durable framework and into its own activity. By separating the Linebot event handling from the Azure Durable Function, you can isolate the responsibilities of each component and make your code more modular and easier to manage.
Linebot event handler
@handler.add(MessageEvent, message=TextMessage)
def handle_message(event):
# Process the message here
response = process_message(event.message.text)
# Reply to the Linebot message
line_bot_api.reply_message(
event.reply_token,
TextSendMessage(text=response),
timeout=None
)
Azure Durable Function
@func.durable_activity_function
def process_message(message_text):
# Perform some processing on the message text
processed_message = "Processed message: " + message_text
return processed_message
In this example, the Linebot event handler handle_message
is responsible for receiving the message event, calling the Azure Durable Function process_message
to process the message text, and then sending a reply. Adjust this example according to your specific needs and ensure that your function has the necessary permissions to perform its tasks.
do let me know incase of further queries.