Class N8nService
java.lang.Object
org.bgerp.plugin.ai.aixflow.service.N8nService
Service for communicating with n8n external service
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
deleteTask
(Connection con, String taskId) Delete a task from n8n and from the databaseboolean
handleN8nCallback
(Connection con, String taskId, String status, String result, String errorMessage) Handle a callback from n8n with task resultsrequestTaskDataFromN8n
(Connection con, String taskId) Request task data from n8nsendFileToN8n
(Connection con, int fileId, String secret) Send a file to n8n for processing
-
Constructor Details
-
N8nService
public N8nService()Constructor
-
-
Method Details
-
sendFileToN8n
Send a file to n8n for processing- Parameters:
con
- database connectionfileId
- the file ID to sendsecret
- the file secret- Returns:
- the created task
- Throws:
Exception
- if an error occurs
-
handleN8nCallback
public boolean handleN8nCallback(Connection con, String taskId, String status, String result, String errorMessage) throws SQLException Handle a callback from n8n with task results- Parameters:
con
- database connectiontaskId
- the task IDstatus
- the task statusresult
- the task resulterrorMessage
- the error message (if any)- Returns:
- true if the task was updated, false if not found
- Throws:
SQLException
- if a database error occurs
-
requestTaskDataFromN8n
Request task data from n8n- Parameters:
con
- database connectiontaskId
- the task ID to request data for- Returns:
- the response from n8n as a JSON string
- Throws:
Exception
- if an error occurs
-
deleteTask
Delete a task from n8n and from the database- Parameters:
con
- database connectiontaskId
- the task ID to delete- Returns:
- true if the task was deleted, false if not found
- Throws:
Exception
- if an error occurs
-