If the worker errors it wont delete the messages from the queue so they would get retried eventually
If the worker errors it wont delete the messages from the queue so they would get retried eventually







fetch handler so if you mean you want fetch w/ Hono and queue handlers in the same project, then just do it like this
scheduled worker right?



queuescheduledexport interface Env {
MY_QUEUE: Queue;
}
export default {
async fetch(req: Request, env: Env, ctx: ExecutionContext): Promise<Response> {
// if req.method is not POST , reject
if (req.method !== 'POST') {
return new Response('Sorry', { status: 405 });
}
const body = await req.json();
console.log(`got body: ${JSON.stringify(body)}`)
const result = await env.MY_QUEUE.send({
body: body,
contentType: "json",
});
console.log(`sent message to queue: ${JSON.stringify(result)}`);
return new Response(JSON.stringify({
return_code: "1",
return_message: "ok"
}), {
headers: { 'Content-Type': 'application/json' },
});
},
};"logs": [
{
"message": [
"got body: {\"data\":\"dat hart fd3 3\"}"
],
"level": "log",
"timestamp": 1696396087813
},
{
"message": [
"sent message to queue: undefined"
],
"level": "log",
"timestamp": 1696396087867
}
]export default {
fetch: app.fetch,
async queue(...) { ... }
}