-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SQS Queue type-safe integration class #58
Comments
How should we go about layering this?
For supporting an arbitrary export interface ReadCodec<Value, Data> {
read(data: Data): Value;
}
export interface WriteCodec<Value, Data> {
write(value: Value): Data;
}
export interface Codec<Value, Data>
extends ReadCodec<Value, Data>,
WriteCodec<Value, Data> {}
export class JsonCodec<T> implements Codec<T, string> {
public read(data: string): T {
return JSON.parse(data);
}
public write(value: T): string {
return JSON.stringify(value);
}
} |
Could we do the same contract as secret? Textqueue and jsonqueue? Roll parse into the integration? |
I was thinking the same, although we may need to consider cases like Avro, ProtoBuf, Flatbuffers, etc. So i was wondering if we could have a Codec abstraction - quickly run into limitations with closure serialization and |
That said, JsonSecret likely covers 99% of cases ha |
Keep it simple? Anyone can make another overload and more l2s? |
for interface SQSRecord<T> {
body: string; // <- this is the vanilla AWS API
value: T; // <- maybe we add a new field? Or should we override body?
} |
Make it explicit to not polite the sfn state? |
I don't know what you mean? |
Hmm, if this is the interface public forEach(
handler: Function<SQSEvent<T>, lambda.SQSBatchResponse>,
props?: aws_lambda_event_sources.SqsEventSourceProps
): void {
handler.resource.addEventSource(
new aws_lambda_event_sources.SqsEventSource(this.resource, props)
);
} And we want to inject code that parses the body string, how would we inject that into the Function? Should we instead change the interface to be public forEach(scope: Construct, id: string, props: FunctionProps & SqsEventSourceProps, handle: (event: ..) => ..) And then have the |
Looks good to me, and make the scope optional? |
Yep, even id can default to "forEach" |
Which would work in 99% of cases because it's not like you'd ever attach two consumers |
let n = 0;
let name = "forEach";
do {
const child = queue.node.tryFindChild(name);
if(!child) {
break;
}
name = `forEach${++n}`;
} while(true); |
Sure that would work. But it has risks because of you remove one in the middle they all change. |
Uhhgg, yeah, good point. Lets enforce the singleton when the automatic name is used? |
Provide a wrapper class,
Queue<T>
, that models the SQS Queue Functionless integrations.Must integrates with the following:
The text was updated successfully, but these errors were encountered: