I have a small query regarding someip sd, in vsomeip stack eventgroups for the server are configured as follows
{
"eventgroup" : "0x4465",
"events" : [ "0x778", "0x779" ],
"is_multicast" : "true"
}
server offers a service for the eventgroup 0x4465,
when client subscribes to the event group id 0x4465 , client gets the notifications with event id as 0x0778 in someip header, is it correct? or client should get the notifications with event id as 0x4465(same as eventgroup id) in someip header.which is correct way
Event Groups are just logical grouping of events, they only exist at the service discovery level SOME/IP-SD.
The events themselves contain no information about the event groups, and will use the ids 0x778 and 0x779.
Related
I am working on stripe subscription integration in my Spring Boot application. I am able to successfully redirect user to the checkout page and process the payment. I am working on the no-code application and the business model of my app is to charge the customer for each project created. Each time the user process the payment I am saving the customer-id and subscription-id in the database of the project but in order to subscribe to the same customer for the next project I have to create a new customer in the Stripe account and then the same flow continues. So, is it possible to subscribe the same customer for a new project without creating the customer in the stripe account?
I don't see why not. You just need to pass the existing customer Id when creating a checkout session.
That's what I'm doing:
If a user doesn't have a stripe customer created, I create one and store the customer id against my internal user id (I also send the user id in the customer metadata to stripe, so it's easy to correlate them, as they may use different email addresses for payment).
If a customer already exists for the current user, I just use that one.
I'm using typescript, the concept is the same:
// uid is my internal user id
const customerId = getOrCreateCustomer(uid);
const newSession: StripeType.Checkout.SessionCreateParams = {
customer: customerId,
mode: 'subscription',
payment_method_types: ['card'],
customer_update: {
address: 'auto',
name: 'auto',
shipping: 'auto',
},
subscription_data: {
metadata: { uid }, // store uid in subscription metadata as well
},
line_items: [
{
price: priceId,
quantity: 1,
}
],
success_url: successUrl,
cancel_url: cancelUrl,
};
Need help with socketio one to one chat.
I have read tons of example stating to create a room for private chat.
The example one I always get will be something like this :
io.on('connection', socket => {
//Get the chatID of the user and join in a room of the same chatID
chatID = socket.handshake.query.chatID
socket.join(chatID)
//Leave the room if the user closes the socket
socket.on('disconnect', () => {
socket.leave(chatID)
})
//Send message to only a particular user
socket.on('send_message', message => {
receiverChatID = message.receiverChatID
senderChatID = message.senderChatID
content = message.content
//Send message to only that particular room
socket.in(receiverChatID).emit('receive_message', {
'content': content,
'senderChatID': senderChatID,
'receiverChatID':receiverChatID,
})
})
});
But I can't get my head around: as in this example for the room "receiverChatID", all user who are currently sending message to the same receiver [say user2] will receive a broadcast of the messages other user are sending.
For example user 1 and user 2 are having private chat conversation. The chat room id is "user2".
Now user3 sends message to user 2, again the room name will be "user2" and hence when a broadcast will be done, both user 3 and user 1 will receive messages , even though they should be private individually.
One way will be to create a unique chat-room-id between two users, and maintain in it some data store.If that is the way to do it, then how to create unique chat room id, specifically, when user join and leave and re-join save room.
And query this unqique room for two users, whenever they join in ?
Say I create a map : {roomid1: MD5["user1","user2"]}.
Now how do you decide the order of user1 and user 2 [alphabetical I guess], so for two pairs of users one unique room id is created ?
How do you solve this problems for one to one chat ?
I am inserting events with custom properties in Cumulocity. Is there any way to filter events by there custom properties?
Depends on what do you mean by "filter events by custom properties". If you mean filter by a custom "key" inside the event like:
{
"text" : "my custom event",
"type" : "event type",
"id" : "c8yId",
"time" : "time",
"custom_key" : "specific value"
}
You can use the Cumulocity API using the "fragmentType" in the request. You can do this by sending the "custom_key" as a filter like so:
GET /event/events?fragmentType="custom_key" HTTP/1.1
Host: tenant.cumulocity.com
Authorization: Basic .....
That will return all event with that specific key.
In the other hand, if you want to filter by a custom "key" with a "specific value", you can do this by creating a simple microservice that does that for you. In the microservice you send the same request (above), then filter the result by comparing the value of "custom_key" with the value you want to filter and then send the events matched as a result.
Hope this help!
{{url}}/event/events?fragmentType=custom_key&fragmentValue=xyz
I am using Google Calendar API in my application for Recurring events(create, update and delete operations), but i am unable to find if a recurring event is an instance event or an exception event
Creating recurring events is similar to creating a regular (single) event with the event resource's recurrence field set.
POST /calendar/v3/calendars/primary/events
...
{
"summary": "Appointment",
"location": "Somewhere",
"start": {
"dateTime": "2011-06-03T10:00:00.000-07:00",
"timeZone": "America/Los_Angeles"
},
"end": {
"dateTime": "2011-06-03T10:25:00.000-07:00",
"timeZone": "America/Los_Angeles"
},
"recurrence": [
"RRULE:FREQ=WEEKLY;UNTIL=20110701T170000Z",
],
"attendees": [
{
"email": "attendeeEmail",
# Other attendee's data...
},
# ...
],
}
To see all the instances of a given recurring event you can use the events.instances() request.
The events.list() request by default only returns single events, recurring events, and exceptions; instances that are not exceptions are not returned. If the singleEvents parameter is set then all the individual instances do appear in the result, but not the underlying recurring events.
for more information please see recurringevents
Unfortunately, there is no way to identify if the instance is an exception of the recurring event. The only work around is to diff the instance with the master event or use the originalStartTime which uniquely identifies the instance (can compare the originalStartTime with the start objects date/dateTime, though this would fail if you had changed the summary or other text field).
The way I have handled this issue is by making an incremental change request with the nextSyncToken. If an exception was made, an instance will be in the payload that is returned from the list call. I check if that instance has a recurringEventId attribute associated with it and if it does, I know that that instance is an exception.
Would highly advocate for Google to include a system similar to that of Microsoft Graph which utilizes an attribute that identifies whether the event is an instance or an exception.
source: https://developers.google.com/calendar/recurringevents
I have a set of internal users for my project. Admin can activate/deactivate them. I want to send them a mail saying "your account has been deactivated" when their account is deactivated by admin. Similarly they should receive a mail saying "your account has been activated" when admin activates their account. How can I do this?
I am trying by creating 2 separate lists in mailchimp and two separate campaigns. but when I'm writing mailchimps credentials in my development.js with 2 separate list ids and then trying to get it in my javascript file,it is getting undefined (checked by console.log)..
Is there a way to do it by just single campaign/list?
Here's my development.js code of mailchimp credentials:
mailchimp: {
api_key: "***************-***",
list_id1: "*********", //internal users
list_id2: "*********" //internal deactivated users
},
my user.helper.js
const config = require('../../config/environment');
const Mailchimp = require('mailchimp-api-3');
const mailchimp = new Mailchimp(config.mailchimp.api_key);
exports.addToDeactivatedList = function (email, name) {
console.log(mailchimp.list_id1);
mailchimp.members.create(config.mailchimp.list_id1, {
email_address: email,
merge_fields: {
FNAME: name
},
status: 'subscribed'
}).then(user => { }).catch(e => {
console.log("deactivate list me add ho gya");
})
}
exports.addToActivatedList = function (email, name) {
console.log(mailchimp.list_id2);
mailchimp.members.create(config.mailchimp.list_id2, {
email_address: email,
merge_fields: {
FNAME: name
},
status: 'subscribed'
}).then(user => { }).catch(e => {
console.log("activate list me add ho gya");
})
}
and my user.controller.js (selective part only)
var helper = require('./user.helper');
.
.
if(req.body.status != user.status){
(req.body.status == "active") ? helper.addToActivatedList(user.email, user.name) : helper.addToDeactivatedList(user.email, user.name);
}
All the help will be appreciated. THANKS
I'd try to put everyone in the same list, and then create segments based on that list. After that, create a campaign based on that segment.
You could for instance create a custom list attribute that records wether or not an account is activated and create a segment based on that attribute. The campaign should then be based on that segment.
Perhaps also record the date an account has been activated or deactivated by the admin in another custom attribute and use that to check if a user already had an activation/deactivation mail.
MailChimp offers a feature for situations like this called automations. Automations allow you to send individual emails to subscribers when an event is triggered. So instead of creating separate campaigns every time a user is activated or deactivated, you can use just two automations and a single list.
Whether a user is active or not can be tracked with list merge fields. To do this, you'll need to add a new text merge field to your list. Let's name the field label 'Active'. Uncheck the 'Visible' checkbox so the user can't see it, and name your merge field something like 'ACTIVE'. You can use values like yes/no or true/false to identify the users by their active status.
Next, create your automations, one for activated users and one for deactivated users. You can set a trigger to send the email when a list field value is changed. So just make each of your two automations send the emails when the 'Active' list field values change to either 'yes' or 'no'.
Then all you need to do with the API is subscribe users to a single list whenever their accounts are activated or deactivated. Just make sure the new 'ACTIVE' merge field is set to 'yes' or 'no' when you do this, and any addresses already subscribed will be updated with the new value. So your mailchimp.members.create() would look something like this, based on the example from here:
mailchimp.members.create(<list_id>, {
email_address: <user_email>,
merge_fields: {
FNAME: name,
ACTIVE: 'yes' //Or 'no' if being used for deactivated users
},
status: 'subscribed'
})