-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[ServiceBus] Rollup for browser #2555
Conversation
@@ -17,6 +17,9 @@ | |||
}, | |||
"main": "./dist/index.js", | |||
"module": "dist-esm/src/index.js", | |||
"browser": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May not need this, will try removing.
Latest commits work with all the non-AAD-using samples I've tested with. E.g. you can build this branch and create the following html file under samples/browser: <script src="../../browser/service-bus.js"></script>
<script>
const SBC = Azure.Messaging.ServiceBus.ServiceBusClient;
const connectionString = "";
const queueName = "";
const listOfScientists = [
{ name: "Einstein", firstName: "Albert" },
{ name: "Heisenberg", firstName: "Werner" },
{ name: "Curie", firstName: "Marie" },
{ name: "Hawking", firstName: "Steven" },
{ name: "Newton", firstName: "Isaac" },
{ name: "Bohr", firstName: "Niels" },
{ name: "Faraday", firstName: "Michael" },
{ name: "Galilei", firstName: "Galileo" },
{ name: "Kepler", firstName: "Johannes" },
{ name: "Kopernikus", firstName: "Nikolaus" }
];
async function main() {
const ns = SBC.createFromConnectionString(connectionString);
// If sending to a Topic, use `createTopicClient` instead of `createQueueClient`
const client = ns.createQueueClient(queueName);
const sender = client.createSender();
try {
for (let index = 0; index < listOfScientists.length; index++) {
const scientist = listOfScientists[index];
const message = {
body: `${scientist.firstName} ${scientist.name}`,
label: "Scientist"
};
console.log(`Sending message: ${message.body} - ${message.label}`);
await sender.send(message);
}
await client.close();
} finally {
await ns.close();
}
}
main().catch((err) => {
console.log("Error occurred: ", err);
});
</script> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Verified on local that this works.
@ramya0820 this should be ready for you to build on! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can fix conflicts and merge
This PR enables browser builds by copying the approach taken for amqp-common.
The global name is Azure.Messaging.ServiceBus.