I created an app on Azure and want to use it to subscribe to business emails of certain users. However, I cannot get it to work and I'm wondering if it is even possible this way. The code is as follows:
url = 'https://graph.microsoft.com/beta/subscriptions'
payload = {
'changeType': 'updated',
'notificationUrl': 'http://<server_ip>/webhook',
'resource': "users/<my_user>#<my_domain>/mailFolders('inbox')/messages",
'expirationDateTime': '2022-07-23T11:52:20',
}
headers = {
'Authorization': f'Bearer {access_token}',
'Content-Type': 'application/json'
}
response = requests.post(url, headers=headers, data=json.dumps(payload))
print(response.status_code)
print(response.reason)
print(response.text)
400
Bad Request
{"error":{"code":"InvalidRequest","message":"Could not process subscription creation
payload. Are all property names spelled and camelCased properly? Also are the
dateTimeOffest properties in a valid internet Date and Time format?","innerError":
{"date":"2022-07-22T09:12:11","request-id":"317989f4-c921-44ce-a701-
c57a660aad3b","client-request-id":"317989f4-c921-44ce-a701-c57a660aad3b"}}}
I also want to subsribe to changes to our drive, for this I substitute the resource for f'drives/{drive_id}/root'. This gives the same error messsage.
I have read all the relevant docs and feel this this should be the correct approach, but the error message is not useful to me for find the issue.
I use gatling to send data to an ActiveMQ. The payload is generated in a separate method. The response should also be validated. However, how can I access the session data within the checks
check(bodyString.is()) or simpleCheck(...)? I have also thought about storing the current payload in a separate global variable, but I don't know if this is the right approach. My code's setup looks like this at the moment:
val scn = scenario("Example ActiveMQ Scenario")
.exec(jms("Test").requestReply
.queue(...)
.textMessage{ session => val message = createPayload(); session.set("payload", payload); message}
.check(simpleCheck{message => customCheck(message, ?????? )})) //access stored payload value, alternative: check(bodystring.is(?????)
def customCheck(m: Message, string: String) = {
// check logic goes here
}
Disclaimer: providing example in Java as you don't seem to be a Scala developper, so Java would be a better fit for you (supported since Gatling 3.7).
The way you want to do things can't possibly work.
.textMessage(session -> {
String message = createPayload();
session.set("payload", payload);
return message;
}
)
As explained in the documentation, Session is immutable, so in a function that's supposed to return the payload, you can't also return a new Session.
What you would have to do it first store the payload in the session, then fetch it:
.exec(session -> session.set("payload", createPayload()))
...
.textMessage("#{payload}")
Regarding writing your check, simpleCheck doesn't have access to the Session. You have to use check(bodyString.is()) and pass a function to is, again as explained in the documentation.
I am running InfluxDB and Telegraf ingesting MQTT data into the database. I have an odd behavior where in I am missing some data that I should be ingesting with Telegraf. I'm seeing loads of MQTT data, from topics and subtopics that are siblings of the missing data, but yet some data is still missing. I'm also not seeing anything indicating an error in the logs. This is my telegraf.conf
[[outputs.influxdb_v2]]
urls = ["http://influxdb:8086"]
token = "$KTS_TELEMETRY_INFLUXDB_TOKEN"
organization = "$KTS_TELEMETRY_INFLUXDB_ORG"
bucket = "$KTS_TELEMETRY_INFLUXDB_BUCKET"
[[inputs.mqtt_consumer]]
data_format = "json"
servers = ["tcp://10.0.200.10:1883"]
topics = [
"/sample/#"
]
And I am getting data on topics like /sample/runout/data and other subtopics, but I'm not getting anything on one of my topics, /sample/runout/status. I can see that there definitely is data coming across the wire on that topic however, running this command gives me plenty of data constantly.
mosquitto_sub -h 10.0.200.10 -t /sample/runout/status
Running the same command with /sample/runout/data also shows lots of messages just the same. Oddly /sample/runout/data is showing up in the database but /sample/runout/status is not.
This is one example of a message published to /sample/runout/status
{"RollingReady":false,"TwinSAFE_enable":false,"ReceivedDataValid":false,"FramesAligned":false,"FramesCoupled":false,"inner_frame":{"virtualAxisJogEnabled":true,"virtualAxisJogReady":false,"motionReady":false,"motionAccepted":false},"outer_frame":{"virtualAxisJogEnabled":true,"virtualAxisJogReady":false,"motionReady":false,"motionAccepted":false},"inner_big_vee":{"axesInPosition":true,"enabled":false,"error":false,"initialized":false,"operational":false,"payoutMode":false,"payoutReady":false,"ready":false,"rollingMode":true,"rollingReady":false},"outer_big_vee":{"axesInPosition":true,"enabled":false,"error":false,"initialized":false,"operational":false,"payoutMode":false,"payoutReady":false,"ready":false,"rollingMode":true,"rollingReady":false},"support_i1":{"axesInPosition":true,"enabled":false,"error":false,"initialized":false,"operational":false,"payoutMode":false,"payoutReady":false,"ready":false,"rollingMode":true,"rollingReady":false},"support_a1":{"axesInPosition":true,"enabled":false,"error":false,"initialized":false,"operational":false,"payoutMode":false,"payoutReady":false,"ready":false,"rollingMode":true,"rollingReady":false},"support_a2":{"axesInPosition":true,"enabled":false,"error":false,"initialized":false,"operational":false,"payoutMode":false,"payoutReady":false,"ready":false,"rollingMode":true,"rollingReady":false},"support_a3":{"axesInPosition":true,"enabled":false,"error":false,"initialized":false,"operational":false,"payoutMode":false,"payoutReady":false,"ready":false,"rollingMode":true,"rollingReady":false},"support_b1":{"axesInPosition":false,"enabled":false,"error":false,"initialized":false,"operational":false,"payoutMode":false,"payoutReady":false,"ready":false,"rollingMode":true,"rollingReady":false},"support_b2":{"axesInPosition":false,"enabled":false,"error":false,"initialized":false,"operational":false,"payoutMode":false,"payoutReady":false,"ready":false,"rollingMode":true,"rollingReady":false},"support_b3":{"axesInPosition":false,"enabled":false,"error":false,"initialized":false,"operational":false,"payoutMode":false,"payoutReady":false,"ready":false,"rollingMode":true,"rollingReady":false},"support_b4":{"axesInPosition":false,"enabled":false,"error":false,"initialized":false,"operational":false,"payoutMode":false,"payoutReady":false,"ready":false,"rollingMode":true,"rollingReady":false},"support_c1":{"axesInPosition":false,"enabled":false,"error":false,"initialized":false,"operational":false,"payoutMode":false,"payoutReady":false,"ready":false,"rollingMode":true,"rollingReady":false},"support_c2":{"axesInPosition":false,"enabled":false,"error":true,"initialized":false,"operational":false,"payoutMode":false,"payoutReady":false,"ready":false,"rollingMode":true,"rollingReady":false},"support_c3":{"axesInPosition":false,"enabled":false,"error":true,"initialized":false,"operational":false,"payoutMode":false,"payoutReady":false,"ready":false,"rollingMode":true,"rollingReady":false},"support_c4":{"axesInPosition":false,"enabled":false,"error":true,"initialized":false,"operational":false,"payoutMode":false,"payoutReady":false,"ready":false,"rollingMode":true,"rollingReady":false},"support_d1":{"axesInPosition":false,"enabled":false,"error":true,"initialized":false,"operational":false,"payoutMode":false,"payoutReady":false,"ready":false,"rollingMode":true,"rollingReady":false},"support_d2":{"axesInPosition":false,"enabled":false,"error":true,"initialized":false,"operational":false,"payoutMode":false,"payoutReady":false,"ready":false,"rollingMode":true,"rollingReady":false}}
The only thing I can thing of of significance here is that all of the values in this sub topic are booleans but the InfluxDB supports booleans just fine. What am I missing? I haven't been able to find any helpful ways to debug this.
The answer here turned out to be that the input data_format="json" does not support booleans. I needed to upgrade to json_v2. This was not exactly clear to me how to just get the same exact behavior because the documentation wasn't really great. But I ended up with this and it works just fine.
[[outputs.influxdb_v2]]
urls = ["http://influxdb:8086"]
token = "$KTS_TELEMETRY_INFLUXDB_TOKEN"
organization = "$KTS_TELEMETRY_INFLUXDB_ORG"
bucket = "$KTS_TELEMETRY_INFLUXDB_BUCKET"
[[inputs.mqtt_consumer]]
data_format = "json_v2"
servers = ["tcp://10.0.200.10:1883"]
topics = [
"/sample/#"
]
[[inputs.mqtt_consumer.json_v2]]
[[inputs.mqtt_consumer.json_v2.object]]
path = "#this"
excluded_keys = []
I'm having some issues configuring MassTransit with SQS. My goal is to have N consumers which create N queues and each of them accept a different message type. Since I always have a 1 to 1 consumer to message mapping, I'm not interested in having any sort of fan-out behaviour. So publishing a message of type T should publish it directly to that queue. How exactly would I configure that? This is what I have so far:
services.AddMassTransit(x =>
{
x.AddConsumers(Assembly.GetEntryAssembly());
x.UsingAmazonSqs((context, cfg) =>
{
cfg.Host("aws", h =>
{
h.AccessKey(mtSettings.AccessKey);
h.SecretKey(mtSettings.SecretKey);
h.Scope($"{mtSettings.Environment}", true);
var sqsConfig = new AmazonSQSConfig() { RegionEndpoint = RegionEndpoint.GetBySystemName(mtSettings.Region) };
h.Config(sqsConfig);
var snsConfig = new AmazonSimpleNotificationServiceConfig()
{ RegionEndpoint = RegionEndpoint.GetBySystemName(mtSettings.Region) };
h.Config(snsConfig);
});
cfg.ConfigureEndpoints(context, new BusEnvironmentNameFormatter(mtSettings.Environment));
});
});
The BusEnvironmentNameFormatter class overrides KebabCaseEndpointNameFormatter and adds the environment as a prefix, and the effect is that all the queues start with 'dev', while the h.Scope($"{mtSettings.Environment}", true) line does the same for topics.
I've tried to get this working without configuring topics at all, but I couldn't get it working without any errors. What am I missing?
The SQS docs are a bit thin, but is at actually possible to do a bus.Publish() without using sns topics or are they necessary? If it's not possible, how would I use bus.Send() without hardcoding queue names in the call?
Cheers!
Publish requires the use of topics, which in the case of SQS uses SNS.
If you want to configure the endpoints yourself, and prevent the use of topics, you'd need to:
Set ConfigureConsumeTopology = false – this prevents topics from being created and connected to the receive endpoint queue.
Set PublishFaults = false – this prevents fault topics from being created when a consumer throws an exception.
Don't call Publish, because, obviously that will create a topic.
If you want to somehow establish a convention for your receive endpoint names that aligns with your ability to send messages, you could create your own endpoint name formatter that would use message types and then use those same names to call GetSendEndpoint using the queue:name short name syntax to Send messages directly to those queues.
I am integrating the Carrier (USPS, UPS, DHL, FeDex) API with my application.
For that i need to find different statuses for that shipment like is it delivered or not, which is getting me properly.
Similarly, i need to check whether the shipment required the signature or not?
How do i came to know this using the different API?
Regards,
Salil Gaikwad
Not all APIs support the same functionality. All will tell you the current status and some will provide the shipper/recipient information but I don't believe any will tell you if it was sent signature required.
E.g. for FedEx if you want to know about parcel's tracking events (delivered or not, any problems, delivery time and many other info) use this service endpoint - https://ws.fedex.com:443/web-services/track. The request to FedEx will be look like this (C# sample):
TrackRequest request = new TrackRequest();
request.WebAuthenticationDetail = new WebAuthenticationDetail();
request.WebAuthenticationDetail.UserCredential = new WebAuthenticationCredential()
{
Key = "ApiKey",
Password = "PasswordKey"
};
request.ClientDetail = new ClientDetail
{
AccountNumber = "...",
MeterNumber = "..."
};
request.TransactionDetail = new TransactionDetail();
request.PackageIdentifier = new TrackPackageIdentifier();
request.PackageIdentifier.Value = "parcel tracking number";
request.PackageIdentifier.Type = TrackIdentifierType.TRACKING_NUMBER_OR_DOORTAG;
request.IncludeDetailedScans = true;
request.IncludeDetailedScansSpecified = true;
request.Version = new VersionId();
When you receive from FedEx - TrackReply, you should check TrackDetails array. There will be tracking info. As for other carriers, the common idea is the same. Almost every carrier use tracking number.